From c70271ee4729ac480de72223376ef0ac817939fa Mon Sep 17 00:00:00 2001 From: kobewi Date: Fri, 14 Oct 2022 17:51:57 +0200 Subject: [PATCH] Change EditorSpinSlider's popup to Control --- editor/editor_spin_slider.cpp | 11 ++++------- editor/editor_spin_slider.h | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 1cdfceebc81..11a8fce9c31 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -619,11 +619,9 @@ bool EditorSpinSlider::is_grabbing() const { void EditorSpinSlider::_focus_entered() { _ensure_input_popup(); - Rect2 gr = get_screen_rect(); value_input->set_text(get_text_value()); - value_input_popup->set_position(gr.position); - value_input_popup->set_size(gr.size); - value_input_popup->call_deferred(SNAME("popup")); + value_input_popup->set_size(get_size()); + value_input_popup->call_deferred(SNAME("show")); value_input->call_deferred(SNAME("grab_focus")); value_input->call_deferred(SNAME("select_all")); value_input->set_focus_next(find_next_valid_focus()->get_path()); @@ -658,14 +656,13 @@ void EditorSpinSlider::_ensure_input_popup() { return; } - value_input_popup = memnew(Popup); + value_input_popup = memnew(Control); add_child(value_input_popup); value_input = memnew(LineEdit); value_input_popup->add_child(value_input); - value_input_popup->set_wrap_controls(true); value_input->set_anchors_and_offsets_preset(PRESET_FULL_RECT); - value_input_popup->connect("popup_hide", callable_mp(this, &EditorSpinSlider::_value_input_closed)); + value_input_popup->connect("hidden", callable_mp(this, &EditorSpinSlider::_value_input_closed)); value_input->connect("text_submitted", callable_mp(this, &EditorSpinSlider::_value_input_submitted)); value_input->connect("focus_exited", callable_mp(this, &EditorSpinSlider::_value_focus_exited)); value_input->connect("gui_input", callable_mp(this, &EditorSpinSlider::_value_input_gui_input)); diff --git a/editor/editor_spin_slider.h b/editor/editor_spin_slider.h index afcaa3e4b67..fd5c3dc5dff 100644 --- a/editor/editor_spin_slider.h +++ b/editor/editor_spin_slider.h @@ -63,7 +63,7 @@ class EditorSpinSlider : public Range { Vector2 grabbing_spinner_mouse_pos; double pre_grab_value = 0.0; - Popup *value_input_popup = nullptr; + Control *value_input_popup = nullptr; LineEdit *value_input = nullptr; bool value_input_just_closed = false; bool value_input_dirty = false;