makepad_platform/display_context.rs
1use crate::DVec2;
2
3const DEFAULT_MIN_DESKTOP_WIDTH: f64 = 860.;
4
5/// The current context data relevant to adaptive views.
6/// Later to be expanded with more context data like platfrom information, accessibility settings, etc.
7#[derive(Clone, Debug, Default)]
8pub struct DisplayContext {
9 pub updated_on_event_id: u64,
10 pub screen_size: DVec2,
11}
12
13impl DisplayContext {
14 pub fn is_desktop(&self) -> bool {
15 self.screen_size.x >= DEFAULT_MIN_DESKTOP_WIDTH
16 }
17}