diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-05-09 23:33:45 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-05-09 23:35:24 +0200 |
commit | 728fa3ff71361f527e0bf18c46cf9152ec5a3d6d (patch) | |
tree | b419f73e4d54eb9d402f0049f6ba924e3ee61f29 /editor/editor_node.cpp | |
parent | 6e3f47983cabb5f162eaec075d810f717985beda (diff) |
Handle portrait mode monitors in the automatic editor scale detection
Using the smallest dimension of the width and height makes it possible
to support both landscape and portrait monitors.
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 7aed5b2b7f..7917af94d1 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5684,15 +5684,17 @@ EditorNode::EditorNode() { editor_set_scale(DisplayServer::get_singleton()->screen_get_max_scale()); #else const int screen = DisplayServer::get_singleton()->window_get_current_screen(); + // Use the smallest dimension to use a correct display scale on portait displays. + const int smallest_dimension = MIN(DisplayServer::get_singleton()->screen_get_size(screen).x, DisplayServer::get_singleton()->screen_get_size(screen).y); float scale; - if (DisplayServer::get_singleton()->screen_get_dpi(screen) >= 192 && DisplayServer::get_singleton()->screen_get_size(screen).y >= 1400) { + if (DisplayServer::get_singleton()->screen_get_dpi(screen) >= 192 && smallest_dimension >= 1400) { // hiDPI display. scale = 2.0; - } else if (DisplayServer::get_singleton()->screen_get_size(screen).y >= 1700) { + } else if (smallest_dimension >= 1700) { // Likely a hiDPI display, but we aren't certain due to the returned DPI. // Use an intermediate scale to handle this situation. scale = 1.5; - } else if (DisplayServer::get_singleton()->screen_get_size(screen).y <= 800) { + } else if (smallest_dimension <= 800) { // Small loDPI display. Use a smaller display scale so that editor elements fit more easily. // Icons won't look great, but this is better than having editor elements overflow from its window. scale = 0.75; |