1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Expand clip_rects slightly to allow widgets just on the border

This commit is contained in:
Emil Ernerfeldt
2020-04-22 19:40:22 +02:00
parent 104f2191a0
commit 9b404159c5
2 changed files with 8 additions and 12 deletions

View File

@@ -71,12 +71,16 @@ impl Region {
}
pub fn child_region(&self, child_rect: Rect) -> Self {
// Allow child widgets to be just on the border and still have an outline with some thickness
const CLIP_RECT_MARGIN: f32 = 3.0;
Region {
ctx: self.ctx.clone(),
layer: self.layer,
style: self.style,
id: self.id,
clip_rect: self.clip_rect.intersect(child_rect),
clip_rect: self
.clip_rect
.intersect(child_rect.expand(CLIP_RECT_MARGIN)),
desired_rect: child_rect,
cursor: child_rect.min(),
bounding_size: vec2(0.0, 0.0),