ui: fix window size detection
This commit is contained in:
parent
ff66ad7923
commit
c97aa2062d
1 changed files with 4 additions and 8 deletions
|
@ -77,18 +77,14 @@ impl View {
|
||||||
|
|
||||||
/// Get width and height of app window.
|
/// Get width and height of app window.
|
||||||
pub fn window_size(ui: &mut egui::Ui) -> (f32, f32) {
|
pub fn window_size(ui: &mut egui::Ui) -> (f32, f32) {
|
||||||
|
|
||||||
ui.ctx().input(|i| {
|
ui.ctx().input(|i| {
|
||||||
return match i.viewport().inner_rect {
|
return match i.viewport().inner_rect {
|
||||||
None => {
|
None => {
|
||||||
if let Some(size) = i.viewport().monitor_size {
|
let rect = i.screen_rect;
|
||||||
(size.x, size.y)
|
|
||||||
} else {
|
|
||||||
(AppConfig::DEFAULT_WIDTH, AppConfig::DEFAULT_HEIGHT)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some(rect) => {
|
|
||||||
(rect.width(), rect.height())
|
(rect.width(), rect.height())
|
||||||
}
|
},
|
||||||
|
Some(rect) => (rect.width(), rect.height())
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue