-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trigger zoom from pan gestures when pressing ctrl #80994
Conversation
a7c9711
to
dfbe3d0
Compare
dfbe3d0
to
85b9946
Compare
Changes applied as per @AThousandShips comments. |
5ff6812
to
0f1cd7a
Compare
2fd72af
to
ab1764c
Compare
ab1764c
to
ece4938
Compare
Enables zooming using pan + ctrl on macOS trackpads / Magic Mouse. Windows and Linux don't emit pan gesture events, so shouldn't be affected. Not tested on Android.
ece4938
to
6b45694
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works on macOS (should be tested on Android as well, since pan gesture support is not macOS specific).
But I'm not sure why it's necessary, what's the point of using Ctrl+Pan instead of Zoom gesture?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're at it I tested this on the WIP Wayland backend, which implements pan/zoom gestures. It works great! Too bad that this speed isn't really controllable but it looks like a bigger, more general, issue.
@bruvzg I actually see some value in this. I can see some people having issues with pinching reliably and honestly I kinda prefer this way of zooming as it's easier on the hand.
Still, considering that this is an already existing behavior I don't think that this is proposal material, so I approve :)
(Note that this hasn't still been tested on Android)
As @Riteo says, the pinch to zoom gesture is less precise than scrolling (specially for smaller steps) and for many folks not very ergonomic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on Android and it works well!
Thanks! |
Cherry-picked for 4.2.2. |
Fixes #72609
After the gestures refactor in #71685, zooming with ctrl + trackpad panning in macOS stopped working (4.0 beta16).
This PR aims at recovering that behavior, and extending it to other UI elements exposing zoom callbacks (pre-beta16, only
CanvasItemEditor
had this functionality hardcoded).Panning up or right zooms in, down or left zooms out.
Zoom speed is tricky, as there is no
factor
inInputEventPanGesture
we can leverage, and I haven’t found a way to consistently calculate one fromdelta
s. I’ve decided to mimic thedelta
tofactor
logic inplatform/macos/godot_content_view.mm
, multiplying the default scroll zoom factor increase ratio by 0.3. Seems to work well for some UI elements (e.g. tilemaps), but is still too fast for others (e.g. animation tracks).To keep things simple and avoid breaking existing user expectations, I’m not honoring the scroll pans/zooms toggle. I think it makes sense for panning to… pan by default (if this is deemed as potentially confusing to users who expect pan to behave like scroll, it’s an easy fix though).
EDIT: slightly reduced zoom speed, still feels good and natural in the canvas editor, and makes it a bit more precise in animation track editor.