Prevent egui::Window from becoming larger than Viewport (#4199)
* Closes #3987 * Closes #3988 There is a need to prevent egui::Window from becoming larger than the Viewport. --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
parent
0299663cdd
commit
769199648d
|
|
@ -431,6 +431,16 @@ impl<'open> Window<'open> {
|
|||
(0.0, 0.0)
|
||||
};
|
||||
|
||||
{
|
||||
// Prevent window from becoming larger than the constraint rect and/or screen rect.
|
||||
let screen_rect = ctx.screen_rect();
|
||||
let max_rect = area.constrain_rect().unwrap_or(screen_rect);
|
||||
let max_width = max_rect.width();
|
||||
let max_height = max_rect.height() - title_bar_height;
|
||||
resize.max_size.x = resize.max_size.x.min(max_width);
|
||||
resize.max_size.y = resize.max_size.y.min(max_height);
|
||||
}
|
||||
|
||||
// First check for resize to avoid frame delay:
|
||||
let last_frame_outer_rect = area.state().rect();
|
||||
let resize_interaction =
|
||||
|
|
|
|||
Loading…
Reference in New Issue