From 304a1f5b5a3ce6975952f5cd22d688a246367790 Mon Sep 17 00:00:00 2001 From: toger5 Date: Wed, 22 Feb 2017 00:45:31 +0200 Subject: Implemented scrolling factor for smooth trackpad scrolling Working platforms platform: OSX, Windows. Support for almost all ui elements, including project list. --- editor/animation_editor.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'editor/animation_editor.cpp') diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp index 63ed27e60..1e6562fcf 100644 --- a/editor/animation_editor.cpp +++ b/editor/animation_editor.cpp @@ -1871,21 +1871,35 @@ void AnimationKeyEditor::_track_editor_gui_input(const InputEvent &p_input) { if (mb.button_index == BUTTON_WHEEL_UP && mb.pressed) { if (mb.mod.command) { + zoom->set_value(zoom->get_value() + zoom->get_step()); } else { - v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() / 8); + + v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * mb.factor / 8); } } if (mb.button_index == BUTTON_WHEEL_DOWN && mb.pressed) { if (mb.mod.command) { + zoom->set_value(zoom->get_value() - zoom->get_step()); } else { - v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() / 8); + + v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * mb.factor / 8); } } + if (mb.button_index == BUTTON_WHEEL_RIGHT && mb.pressed) { + + h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * mb.factor / 8); + } + + if (mb.button_index == BUTTON_WHEEL_LEFT && mb.pressed) { + + v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * mb.factor / 8); + } + if (mb.button_index == BUTTON_RIGHT && mb.pressed) { Point2 mpos = Point2(mb.x, mb.y) - ofs; -- cgit v1.2.3-70-g09d2