diff options
Diffstat (limited to 'editor/editor_quick_open.cpp')
-rw-r--r-- | editor/editor_quick_open.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/editor/editor_quick_open.cpp b/editor/editor_quick_open.cpp index 50429878f9..6ddccba0e2 100644 --- a/editor/editor_quick_open.cpp +++ b/editor/editor_quick_open.cpp @@ -32,17 +32,26 @@ #include "core/os/keyboard.h" #include "editor/editor_node.h" +#include "editor/editor_scale.h" -void EditorQuickOpen::popup_dialog(const String &p_base, bool p_enable_multi, bool p_dontclear) { +static Rect2i prev_rect = Rect2i(); +static bool was_showed = false; + +void EditorQuickOpen::popup_dialog(const String &p_base, bool p_enable_multi, bool p_dont_clear) { base_type = p_base; allow_multi_select = p_enable_multi; search_options->set_select_mode(allow_multi_select ? Tree::SELECT_MULTI : Tree::SELECT_SINGLE); - popup_centered_clamped(Size2i(600, 440), 0.8f); + + if (was_showed) { + popup(prev_rect); + } else { + popup_centered_clamped(Size2(600, 440) * EDSCALE, 0.8f); + } EditorFileSystemDirectory *efsd = EditorFileSystem::get_singleton()->get_filesystem(); _build_search_cache(efsd); - if (p_dontclear) { + if (p_dont_clear) { search_box->select_all(); _update_search(); } else { @@ -243,6 +252,13 @@ void EditorQuickOpen::_notification(int p_what) { search_box->set_clear_button_enabled(true); } break; + case NOTIFICATION_VISIBILITY_CHANGED: { + if (!is_visible()) { + prev_rect = Rect2i(get_position(), get_size()); + was_showed = true; + } + } break; + case NOTIFICATION_EXIT_TREE: { disconnect("confirmed", callable_mp(this, &EditorQuickOpen::_confirmed)); } break; |