mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-23 04:16:50 +01:00
Fix project manager window position when editor scale is above 100%
This backports a fix from `master` to `3.x` (with simplified code).
This commit is contained in:
parent
fe77fedbbf
commit
416258cd55
@ -2400,7 +2400,6 @@ ProjectManager::ProjectManager() {
|
|||||||
|
|
||||||
{
|
{
|
||||||
int display_scale = EditorSettings::get_singleton()->get("interface/editor/display_scale");
|
int display_scale = EditorSettings::get_singleton()->get("interface/editor/display_scale");
|
||||||
float custom_display_scale = EditorSettings::get_singleton()->get("interface/editor/custom_display_scale");
|
|
||||||
|
|
||||||
switch (display_scale) {
|
switch (display_scale) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -2426,15 +2425,9 @@ ProjectManager::ProjectManager() {
|
|||||||
editor_set_scale(2.0);
|
editor_set_scale(2.0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
editor_set_scale(custom_display_scale);
|
editor_set_scale(EditorSettings::get_singleton()->get("interface/editor/custom_display_scale"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define a minimum window size to prevent UI elements from overlapping or being cut off
|
|
||||||
OS::get_singleton()->set_min_window_size(Size2(750, 420) * EDSCALE);
|
|
||||||
|
|
||||||
// TODO: Resize windows on hiDPI displays on Windows and Linux and remove the line below
|
|
||||||
OS::get_singleton()->set_window_size(OS::get_singleton()->get_window_size() * MAX(1, EDSCALE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files"));
|
FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files"));
|
||||||
@ -2709,6 +2702,20 @@ ProjectManager::ProjectManager() {
|
|||||||
ask_update_settings->get_ok()->connect("pressed", this, "_confirm_update_settings");
|
ask_update_settings->get_ok()->connect("pressed", this, "_confirm_update_settings");
|
||||||
gui_base->add_child(ask_update_settings);
|
gui_base->add_child(ask_update_settings);
|
||||||
|
|
||||||
|
// Define a minimum window size to prevent UI elements from overlapping or being cut off.
|
||||||
|
OS::get_singleton()->set_min_window_size(Size2(750, 420) * EDSCALE);
|
||||||
|
|
||||||
|
// Resize the bootsplash window based on editor display scale.
|
||||||
|
const float scale_factor = MAX(1, EDSCALE);
|
||||||
|
if (scale_factor > 1.0 + CMP_EPSILON) {
|
||||||
|
const Vector2 window_size = OS::get_singleton()->get_window_size() * scale_factor;
|
||||||
|
const Vector2 screen_size = OS::get_singleton()->get_screen_size();
|
||||||
|
const Vector2 window_position = Vector2(screen_size.x - window_size.x, screen_size.y - window_size.y) * 0.5;
|
||||||
|
// Handle multi-monitor setups correctly by moving the window relative to the current screen.
|
||||||
|
OS::get_singleton()->set_window_position(OS::get_singleton()->get_screen_position() + window_position);
|
||||||
|
OS::get_singleton()->set_window_size(window_size);
|
||||||
|
}
|
||||||
|
|
||||||
OS::get_singleton()->set_low_processor_usage_mode(true);
|
OS::get_singleton()->set_low_processor_usage_mode(true);
|
||||||
|
|
||||||
npdialog = memnew(ProjectDialog);
|
npdialog = memnew(ProjectDialog);
|
||||||
|
Loading…
Reference in New Issue
Block a user