diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-09-03 12:31:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-03 12:31:53 +0200 |
commit | 2ee0ca3d43b93a102aaf037c0d947c70359c20fb (patch) | |
tree | 56ca5ee4fb5060a0db7c54dc11be2fb55080d5fc | |
parent | 726711d8c5bcabd914c2a561ac92fa43c2adf0e2 (diff) | |
parent | e33f13840deb5ff97fa43882ab9b8431809ea290 (diff) |
Merge pull request #31916 from puthre/bezier_editor_zoom
Animation Bezier Editor - fixed vertical zoom around mouse
-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 76773a21b1..6728f60e06 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -630,6 +630,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 { @@ -637,10 +638,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 { @@ -648,6 +651,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(); } |