Merge pull request #31916 from puthre/bezier_editor_zoom

Animation Bezier Editor - fixed vertical zoom around mouse
This commit is contained in:
Rémi Verschelde 2019-09-03 12:31:53 +02:00 committed by GitHub
commit 2ee0ca3d43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();
}