mobile: make mobile flag runtime-configurable
we need to pass a few more things around but it's not that bad. This will allow you to launch damus with --mobile for mobile testing without recompilation.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
use crate::app_style::{create_custom_style, dark_mode, desktop_font_size, mobile_font_size};
|
||||
use crate::fonts::setup_fonts;
|
||||
use crate::ui::is_mobile;
|
||||
use eframe::NativeOptions;
|
||||
|
||||
//pub const UI_SCALE_FACTOR: f32 = 0.2;
|
||||
@@ -36,7 +35,7 @@ pub fn generate_mobile_emulator_native_options() -> eframe::NativeOptions {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn setup_cc(cc: &eframe::CreationContext<'_>) {
|
||||
pub fn setup_cc(cc: &eframe::CreationContext<'_>, is_mobile: bool) {
|
||||
let ctx = &cc.egui_ctx;
|
||||
setup_fonts(ctx);
|
||||
|
||||
@@ -48,9 +47,9 @@ pub fn setup_cc(cc: &eframe::CreationContext<'_>) {
|
||||
|
||||
egui_extras::install_image_loaders(ctx);
|
||||
|
||||
ctx.set_visuals(dark_mode(is_mobile()));
|
||||
ctx.set_visuals(dark_mode(is_mobile));
|
||||
|
||||
ctx.set_style(if is_mobile() {
|
||||
ctx.set_style(if is_mobile {
|
||||
create_custom_style(ctx, mobile_font_size)
|
||||
} else {
|
||||
create_custom_style(ctx, desktop_font_size)
|
||||
|
||||
Reference in New Issue
Block a user