1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Require a StrokeKind when painting rectangles with strokes (#5648)

This is a breaking change, requiring users to think about wether the
stroke is inside/centered/outside the rect.

When in doubt, add `egui::StrokeKind::Inside` to the function call.
This commit is contained in:
Emil Ernerfeldt
2025-01-29 15:52:49 +01:00
committed by GitHub
parent 8d2c8c203c
commit 525d435a84
35 changed files with 184 additions and 73 deletions

View File

@@ -1400,7 +1400,7 @@ impl Tessellator {
if self.options.debug_paint_text_rects {
let rect = text_shape.galley.rect.translate(text_shape.pos.to_vec2());
self.tessellate_rect(
&RectShape::stroke(rect.expand(0.5), 2.0, (0.5, Color32::GREEN)),
&RectShape::stroke(rect, 2.0, (0.5, Color32::GREEN), StrokeKind::Outside),
out,
);
}
@@ -2189,7 +2189,12 @@ impl Tessellator {
.flat_map(|clipped_primitive| {
let mut clip_rect_mesh = Mesh::default();
self.tessellate_shape(
Shape::rect_stroke(clipped_primitive.clip_rect, 0.0, stroke),
Shape::rect_stroke(
clipped_primitive.clip_rect,
0.0,
stroke,
StrokeKind::Outside,
),
&mut clip_rect_mesh,
);