You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Native pan and zoom for macOS
This commit is contained in:
@@ -1442,6 +1442,22 @@ void CanvasItemEditor::_gui_input_viewport(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
}
|
||||
|
||||
Ref<InputEventMagnifyGesture> magnify_gesture = p_event;
|
||||
if (magnify_gesture.is_valid()) {
|
||||
|
||||
_zoom_on_position(zoom * magnify_gesture->get_factor(), magnify_gesture->get_position());
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<InputEventPanGesture> pan_gesture = p_event;
|
||||
if (pan_gesture.is_valid()) {
|
||||
|
||||
const Vector2 delta = (int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom) * pan_gesture->get_delta();
|
||||
h_scroll->set_value(h_scroll->get_value() + delta.x);
|
||||
v_scroll->set_value(v_scroll->get_value() + delta.y);
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<InputEventMouseButton> b = p_event;
|
||||
if (b.is_valid()) {
|
||||
// Button event
|
||||
|
||||
Reference in New Issue
Block a user