summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/animation_track_editor.cpp18
-rw-r--r--editor/project_manager.cpp34
-rw-r--r--editor/project_manager.h8
3 files changed, 40 insertions, 20 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index 961eb907bb..fdeee32849 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -1844,11 +1844,14 @@ void AnimationTimelineEdit::_pan_callback(Vector2 p_scroll_vec) {
}
void AnimationTimelineEdit::_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt) {
- if (p_scroll_vec.y < 0) {
- get_zoom()->set_value(get_zoom()->get_value() * 1.05);
+ double new_zoom_value;
+ double current_zoom_value = get_zoom()->get_value();
+ if (current_zoom_value <= 0.1) {
+ new_zoom_value = MAX(0.01, current_zoom_value - 0.01 * SIGN(p_scroll_vec.y));
} else {
- get_zoom()->set_value(get_zoom()->get_value() / 1.05);
+ new_zoom_value = p_scroll_vec.y > 0 ? MAX(0.01, current_zoom_value / 1.05) : current_zoom_value * 1.05;
}
+ get_zoom()->set_value(new_zoom_value);
}
void AnimationTimelineEdit::set_use_fps(bool p_use_fps) {
@@ -5332,11 +5335,14 @@ void AnimationTrackEditor::_pan_callback(Vector2 p_scroll_vec) {
}
void AnimationTrackEditor::_zoom_callback(Vector2 p_scroll_vec, Vector2 p_origin, bool p_alt) {
- if (p_scroll_vec.y < 0) {
- timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05);
+ double new_zoom_value;
+ double current_zoom_value = timeline->get_zoom()->get_value();
+ if (current_zoom_value <= 0.1) {
+ new_zoom_value = MAX(0.01, current_zoom_value - 0.01 * SIGN(p_scroll_vec.y));
} else {
- timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05);
+ new_zoom_value = p_scroll_vec.y > 0 ? MAX(0.01, current_zoom_value / 1.05) : current_zoom_value * 1.05;
}
+ timeline->get_zoom()->set_value(new_zoom_value);
}
void AnimationTrackEditor::_cancel_bezier_edit() {
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 1cd13e10c8..2a9f699ee6 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -1863,6 +1863,8 @@ void ProjectList::_bind_methods() {
ADD_SIGNAL(MethodInfo(SIGNAL_PROJECT_ASK_OPEN));
}
+ProjectManager *ProjectManager::singleton = nullptr;
+
void ProjectManager::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_TRANSLATION_CHANGED:
@@ -1908,10 +1910,8 @@ void ProjectManager::_notification(int p_what) {
}
}
-Map<String, Ref<Texture2D>> ProjectManager::icon_type_cache;
-
Ref<Texture2D> ProjectManager::_file_dialog_get_icon(const String &p_path) {
- return icon_type_cache["ObjectHR"];
+ return singleton->icon_type_cache["ObjectHR"];
}
void ProjectManager::_build_icon_type_cache(Ref<Theme> p_theme) {
@@ -2481,6 +2481,8 @@ void ProjectManager::_version_button_pressed() {
}
ProjectManager::ProjectManager() {
+ singleton = this;
+
// load settings
if (!EditorSettings::get_singleton()) {
EditorSettings::create();
@@ -2523,15 +2525,6 @@ ProjectManager::ProjectManager() {
editor_set_scale(EditorSettings::get_singleton()->get("interface/editor/custom_display_scale"));
break;
}
-
- // Define a minimum window size to prevent UI elements from overlapping or being cut off
- DisplayServer::get_singleton()->window_set_min_size(Size2(750, 420) * EDSCALE);
-
- // TODO: Resize windows on hiDPI displays on Windows and Linux and remove the lines below
- float scale_factor = MAX(1, EDSCALE);
- Vector2i window_size = DisplayServer::get_singleton()->window_get_size();
- DisplayServer::get_singleton()->window_set_size(Vector2i(window_size.x * scale_factor, window_size.y * scale_factor));
-
EditorFileDialog::get_icon_func = &ProjectManager::_file_dialog_get_icon;
}
@@ -2866,10 +2859,27 @@ ProjectManager::ProjectManager() {
SceneTree::get_singleton()->get_root()->connect("files_dropped", callable_mp(this, &ProjectManager::_files_dropped));
+ // Define a minimum window size to prevent UI elements from overlapping or being cut off
+ DisplayServer::get_singleton()->window_set_min_size(Size2(750, 420) * EDSCALE);
+
+ // Resize the bootsplash window based on Editor display scale EDSCALE.
+ float scale_factor = MAX(1, EDSCALE);
+ if (scale_factor > 1.0) {
+ Vector2i window_size = DisplayServer::get_singleton()->window_get_size();
+ Vector2i screen_size = DisplayServer::get_singleton()->screen_get_size();
+ window_size *= scale_factor;
+ Vector2i window_position;
+ window_position.x = (screen_size.x - window_size.x) / 2;
+ window_position.y = (screen_size.y - window_size.y) / 2;
+ DisplayServer::get_singleton()->window_set_size(window_size);
+ DisplayServer::get_singleton()->window_set_position(window_position);
+ }
+
OS::get_singleton()->set_low_processor_usage_mode(true);
}
ProjectManager::~ProjectManager() {
+ singleton = nullptr;
if (EditorSettings::get_singleton()) {
EditorSettings::destroy();
}
diff --git a/editor/project_manager.h b/editor/project_manager.h
index d3cd929eb7..2965dc7d2e 100644
--- a/editor/project_manager.h
+++ b/editor/project_manager.h
@@ -50,8 +50,10 @@ enum FilterOption {
class ProjectManager : public Control {
GDCLASS(ProjectManager, Control);
- static Map<String, Ref<Texture2D>> icon_type_cache;
- static void _build_icon_type_cache(Ref<Theme> p_theme);
+ Map<String, Ref<Texture2D>> icon_type_cache;
+ void _build_icon_type_cache(Ref<Theme> p_theme);
+
+ static ProjectManager *singleton;
TabContainer *tabs;
@@ -139,6 +141,8 @@ protected:
static void _bind_methods();
public:
+ static ProjectManager *get_singleton() { return singleton; }
+
ProjectManager();
~ProjectManager();
};