Mobile: improve formspec scaling on large tablets

This commit is contained in:
MoNTE48 2021-12-02 10:08:47 +01:00
parent 34d0166af9
commit 9454597e32
2 changed files with 12 additions and 0 deletions

View File

@ -487,6 +487,7 @@ void set_default_settings()
settings->setDefault("screen_dpi", "72"); settings->setDefault("screen_dpi", "72");
settings->setDefault("mainmenu_last_selected_world", "1"); settings->setDefault("mainmenu_last_selected_world", "1");
settings->setDefault("device_is_tablet", "false");
// Altered settings for macOS // Altered settings for macOS
#if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__) #if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__)
@ -644,6 +645,9 @@ void set_default_settings()
g_settings->setDefault("hud_scaling", "0.9"); g_settings->setDefault("hud_scaling", "0.9");
g_settings->setDefault("selectionbox_width", "6"); g_settings->setDefault("selectionbox_width", "6");
} }
if (x_inches >= 7.0)
settings->setDefault("device_is_tablet", "true");
} }
#endif // Android #endif // Android
@ -661,6 +665,9 @@ void set_default_settings()
settings->setDefault("debug_log_level", "none"); settings->setDefault("debug_log_level", "none");
settings->setDefault("password_save", "true"); settings->setDefault("password_save", "true");
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
settings->setDefault("device_is_tablet", "true");
// Set the size of the elements depending on the screen size // Set the size of the elements depending on the screen size
if SDVersion4Inch { if SDVersion4Inch {
// 4" iPhone and iPod Touch // 4" iPhone and iPod Touch
@ -687,6 +694,7 @@ void set_default_settings()
settings->setDefault("hud_scaling", "0.9"); settings->setDefault("hud_scaling", "0.9");
settings->setDefault("mouse_sensitivity", "0.25"); settings->setDefault("mouse_sensitivity", "0.25");
settings->setDefault("selectionbox_width", "6"); settings->setDefault("selectionbox_width", "6");
settings->setDefault("device_is_tablet", "false");
} else { } else {
// iPad // iPad
settings->setDefault("mouse_sensitivity", "0.3"); settings->setDefault("mouse_sensitivity", "0.3");

View File

@ -3321,6 +3321,10 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
// In Android, the preferred imgsize should be larger to accommodate the // In Android, the preferred imgsize should be larger to accommodate the
// smaller screensize. // smaller screensize.
double prefer_imgsize = padded_screensize.Y / 10 * gui_scaling; double prefer_imgsize = padded_screensize.Y / 10 * gui_scaling;
// Try to fit 13 coordinates on large tablets.
if (g_settings->getBool("device_is_tablet"))
prefer_imgsize = padded_screensize.Y / 13 * gui_scaling;
#else #else
// Desktop computers have more space, so try to fit 15 coordinates. // Desktop computers have more space, so try to fit 15 coordinates.
double prefer_imgsize = padded_screensize.Y / 15 * gui_scaling; double prefer_imgsize = padded_screensize.Y / 15 * gui_scaling;