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

Better handling of forcibly trying to shink something that can't be

This commit is contained in:
Emil Ernerfeldt
2020-05-01 10:02:53 +02:00
parent f97dcdc9b5
commit 5ac39d9643
4 changed files with 52 additions and 21 deletions

View File

@@ -179,10 +179,18 @@ impl Resize {
let inner_rect = Rect::from_min_size(region.cursor(), state.size);
let desired_size = {
let mut contents_region = region.child_region(inner_rect);
contents_region.clip_rect = region
.clip_rect()
.intersect(&inner_rect.expand(region.style().clip_rect_margin));
// region.debug_text_at(
// inner_rect.min + last_frame_size,
// &format!("last_frame_size: {:?}", last_frame_size),
// );
// If we pull the resize handle to shrink, we want to TRY to shink it.
// After laying out the contents, we might be much bigger.
// In those cases we don't want the clip_rect too be smaller, because
// In those cases we don't want the clip_rect to be smaller, because
// then we will clip the contents of the region even thought the result gets larger. This is simply ugly!
contents_region.clip_rect.max = contents_region
.clip_rect