Skip to content
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

Native pan and zoom for macOS + InputEventGesture #12573

Merged
merged 1 commit into from
Nov 21, 2017

Conversation

poke1024
Copy link
Contributor

@poke1024 poke1024 commented Nov 1, 2017

A bit of an experiment actually; adds native pan and "pinch and zoom" gesture support for the 2d canvas on macOS; no other OS support yet. This is geared towards the native events the OS delivers, which in my experience always gives better results than trying to implement this from the touch points.

The PR changes the current touchpad behavior on macOS; with top of tree, using a two-finger scroll gesture actually triggers a scroll-wheel event and thus behaves like zooming by default; this is not very macOS-y. With this PR, the two-finger scroll on touchpads is now always understood to be a pan as in other macOS native apps (though editors/2d/pan_speed is honored and I suggest setting it to 100 - not part of this PR). A mouse scroll-wheel on the other hand still behaves as it does without this PR.

The big change that probably needs discussion here is adding InputEventGesture and how to pass around these kind of gesture events. Just for the record, QT has something similar: http://doc.qt.io/qt-5/qnativegestureevent.html. I believe it is something different than a touch event.

Bugsquad edit: Fixes #1319.

@poke1024
Copy link
Contributor Author

poke1024 commented Nov 2, 2017

Just realized that this will break scrolling for regular panes; back to the drawing board, I guess :-/

@poke1024
Copy link
Contributor Author

poke1024 commented Nov 3, 2017

Ok, the idea here is to add touchpad support for the 2d and 3d canvas without breaking scrolling behavior for the rest of Godot. This is what it looks like (all navigation done on the touchpad using "pan" and "pinch and zoom" without any additional mouse or keys):

https://www.dropbox.com/s/x5zqyyknt53ykxe/touchpad-demo-20171103.mp4?dl=0

@ghost ghost added this to the 3.0 milestone Nov 4, 2017
@poke1024
Copy link
Contributor Author

poke1024 commented Nov 4, 2017

Added support for graph_editor, uv_editor and grid_editor. It's complete now as far as I see.

@akien-mga akien-mga changed the title Native pan and zoom for macOS Native pan and zoom for macOS + InputEventGesture Nov 16, 2017
@akien-mga
Copy link
Member

Needs a rebase now; otherwise looks fine to me (and InputEventGesture is already mentioned in another issue as necessary), but I'd like @reduz to have a look.

@poke1024
Copy link
Contributor Author

@akien-mga @reduz rebased

@akien-mga
Copy link
Member

Quoting @reduz:

this is pretty impressive
seems also good to me

So good to merge, I'll just ask for a last rebase :)

@akien-mga
Copy link
Member

BTW, it fixes #1319 for the base API and macOS. I'll open other issues for the Linux and Windows support once this is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants