Add ui.allocate_at_least and ui.allocate_exact_size

This commit is contained in:
Emil Ernerfeldt
2021-01-06 11:03:29 +01:00
parent f68c30e0c7
commit b4871e2aef
15 changed files with 74 additions and 72 deletions
+2 -2
View File
@@ -47,7 +47,7 @@ pub fn drop_target<R>(
let mut content_ui = ui.child_ui(inner_rect, *ui.layout());
let ret = body(&mut content_ui);
let outer_rect = Rect::from_min_max(outer_rect_bounds.min, content_ui.min_rect().max + margin);
let response = ui.allocate_response(outer_rect.size(), Sense::hover());
let (rect, response) = ui.allocate_at_least(outer_rect.size(), Sense::hover());
let style = if is_being_dragged && can_accept_what_is_being_dragged && response.hovered {
ui.style().visuals.widgets.active
@@ -65,7 +65,7 @@ pub fn drop_target<R>(
corner_radius: style.corner_radius,
fill: style.bg_fill,
stroke: style.bg_stroke,
rect: response.rect,
rect,
},
);