1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

Now in screen_rect min is the viewport position and max is the viewport size

This commit is contained in:
Konkitoman
2023-08-12 20:36:41 +03:00
parent 622814d8ed
commit 4bbdab1788
15 changed files with 48 additions and 28 deletions

View File

@@ -179,7 +179,7 @@ impl DemoWindows {
fn mobile_ui(&mut self, ctx: &Context) {
if self.about_is_open {
let screen_size = ctx.input(|i| i.screen_rect.size());
let screen_size = ctx.screen_rect().max.to_vec2();
let default_width = (screen_size.x - 20.0).min(400.0);
let mut close = false;

View File

@@ -116,6 +116,6 @@ fn test_egui_zero_window_size() {
/// Detect narrow screens. This is used to show a simpler UI on mobile devices,
/// especially for the web demo at <https://egui.rs>.
pub fn is_mobile(ctx: &egui::Context) -> bool {
let screen_size = ctx.screen_rect().size();
let screen_size = ctx.screen_rect().max;
screen_size.x < 550.0
}