diff options
author | Valentin Zagura <puthre@gmail.com> | 2019-09-03 00:15:34 +0100 |
---|---|---|
committer | Valentin Zagura <puthre@gmail.com> | 2019-09-03 00:51:55 +0100 |
commit | e33f13840deb5ff97fa43882ab9b8431809ea290 (patch) | |
tree | 3dd080c12beb8cf4e8be61a8fb5c8d6b79e17de3 | |
parent | 8b15ac770c8b4955c1872a253980c9792800374b (diff) |
Animation Bezier Editor - fixed vertical zoom around mouse
Fixed vertical zoom so it zooms around the mouse cursor not around the center of the window.
-rw-r--r-- | editor/animation_bezier_editor.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 14ea18f885..158659c530 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -628,6 +628,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN) { + float v_zoom_orig = v_zoom; if (mb->get_command()) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05); } else { @@ -635,10 +636,12 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { v_zoom *= 1.2; } } + v_scroll = v_scroll + (mb->get_position().y - get_size().y / 2) * (v_zoom - v_zoom_orig); update(); } if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) { + float v_zoom_orig = v_zoom; if (mb->get_command()) { timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05); } else { @@ -646,6 +649,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { v_zoom /= 1.2; } } + v_scroll = v_scroll + (mb->get_position().y - get_size().y / 2) * (v_zoom - v_zoom_orig); update(); } |