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

Clamp eframe window size to at most the size of the largest monitor (#2445)

This can hopefully fix some reported bugs where
This commit is contained in:
Emil Ernerfeldt
2022-12-13 09:09:36 +01:00
committed by GitHub
parent 32677a54e4
commit 4a72abc8ec
4 changed files with 36 additions and 12 deletions

View File

@@ -76,11 +76,14 @@ impl WindowSettings {
}
}
pub fn clamp_to_sane_values(&mut self) {
pub fn clamp_to_sane_values(&mut self, max_size: egui::Vec2) {
use egui::NumExt as _;
if let Some(size) = &mut self.inner_size_points {
// Prevent ridiculously small windows
let min_size = egui::Vec2::splat(64.0);
*size = size.max(min_size);
*size = size.at_least(min_size);
*size = size.at_most(max_size);
}
}
}