diff options
Diffstat (limited to 'editor/editor_spin_slider.cpp')
-rw-r--r-- | editor/editor_spin_slider.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index b6e4375ce9..1b7322fd13 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -63,6 +63,7 @@ void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) { grabbing_spinner_attempt = true; grabbing_spinner_dist_cache = 0; + pre_grab_value = get_value(); grabbing_spinner = false; grabbing_spinner_mouse_pos = Input::get_singleton()->get_mouse_position(); } @@ -107,10 +108,10 @@ void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) { if (ABS(grabbing_spinner_dist_cache) > 6) { set_value(get_value() + SGN(grabbing_spinner_dist_cache)); grabbing_spinner_dist_cache = 0; + pre_grab_value = get_value(); } } else { - set_value(get_value() + get_step() * grabbing_spinner_dist_cache * 10); - grabbing_spinner_dist_cache = 0; + set_value(pre_grab_value + get_step() * grabbing_spinner_dist_cache * 10); } } } else if (updown_offset != -1) { @@ -154,7 +155,7 @@ void EditorSpinSlider::_grabber_gui_input(const Ref<InputEvent> &p_event) { void EditorSpinSlider::_notification(int p_what) { - if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_OUT || p_what == MainLoop::NOTIFICATION_WM_FOCUS_OUT) { + if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_OUT || p_what == MainLoop::NOTIFICATION_WM_FOCUS_IN) { if (grabbing_spinner) { Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); grabbing_spinner = false; @@ -434,6 +435,7 @@ EditorSpinSlider::EditorSpinSlider() { grabbing_spinner_attempt = false; grabbing_spinner = false; grabbing_spinner_dist_cache = 0; + pre_grab_value = 0; set_focus_mode(FOCUS_ALL); updown_offset = -1; hover_updown = false; |