split is_mobile to is_narrow and is_oled
is_mobile doesn't really make sense for android tablets. We were overloading this variable to mean "is_narrow". What we really want is is_oled for mobile devices and is_narrow for if its phone-like. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -72,3 +72,14 @@ pub fn is_compiled_as_mobile() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Determine if the screen is narrow. This is useful for detecting mobile
|
||||
/// contexts, but with the nuance that we may also have a wide android tablet.
|
||||
pub fn is_narrow(ctx: &egui::Context) -> bool {
|
||||
let screen_size = ctx.input(|c| c.screen_rect().size());
|
||||
screen_size.x < 550.0
|
||||
}
|
||||
|
||||
pub fn is_oled() -> bool {
|
||||
is_compiled_as_mobile()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user