diff options
| author | Bernhard Liebl | 2017-11-01 21:49:39 +0100 |
|---|---|---|
| committer | Bernhard Liebl | 2017-11-21 09:11:39 +0100 |
| commit | 80ad8afc85a90e6fda1b136b13c1eb42e35c115e (patch) | |
| tree | bc145bc5c008a2abfa159f4d5437c8d0b8813aca /scene/gui/scroll_container.cpp | |
| parent | 5ff84070ca3604b43e86562a3d000ed924a604a2 (diff) | |
| download | godot-80ad8afc85a90e6fda1b136b13c1eb42e35c115e.tar.gz godot-80ad8afc85a90e6fda1b136b13c1eb42e35c115e.tar.zst godot-80ad8afc85a90e6fda1b136b13c1eb42e35c115e.zip | |
Native pan and zoom for macOS
Diffstat (limited to '')
| -rw-r--r-- | scene/gui/scroll_container.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 9022d67a4..a71a1c5f9 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -180,6 +180,17 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) { time_since_motion = 0; } } + + Ref<InputEventPanGesture> pan_gesture = p_gui_input; + if (pan_gesture.is_valid()) { + + if (h_scroll->is_visible_in_tree()) { + h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() * pan_gesture->get_delta().x / 8); + } + if (v_scroll->is_visible_in_tree()) { + v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * pan_gesture->get_delta().y / 8); + } + } } void ScrollContainer::_update_scrollbar_position() { |
