-
Notifications
You must be signed in to change notification settings - Fork 893
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
support pinch, double tap and rotation gestures on iOS #3130
support pinch, double tap and rotation gestures on iOS #3130
Conversation
I really like the renames: those are much clearer, especially in the context of things like games. Gestures being off-by-default makes sense, but that will need to be aggressively documented. The continuous / discrete distinction is useful; could that be included in module-level docs somewhere? |
c0e18cc
to
2472064
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.
Thanks @mockersf, and apologies for not getting to this sooner! I don't know what you could've done better to push me, the continous updating of the branch worked pretty well to keep it on my radar, I've just been a bit hesitant to review iOS additions (since I'm less familiar with those than macOS).
Maybe we should unify the naming and the meaning of the gestures an probably accumulate them under the same enum? Also, touch screen gestures are different to touchpad ones, usually, but not that much. For example on Wayland I have swipe, hold, and pinch gestures https://wayland.app/protocols/pointer-gestures-unstable-v1 |
I'm also not sure how we should handle the touchpad gestures, since it could be weird to have them on ios, but not on desktop platforms, since touchpad gesture recognition is usually done based on the raw events (unlike touchpad gestures) in the clients, thus winit should be able to map them, but I understand that you generally want to run iOS builtin gesture recognition stuff. Maybe winit should handle touchpad gestures with the help of some lib on linux, but it's a question for the future. Also, I'd suggest to straight rename events without adding aliases, etc, and probably rename to follow the terminology used by wayland since it's more generic and you already did that for pinch. What do you also think about having the device type attached along these events, so you can identified whether it was touchpad or touchscreen or you generally don't have such information on ios/macOS available? |
The In general, I think macOS/iOS tries to hide away which device caused a specific event, at least I can't seem to find any info in the docs on how you'd determine it. |
Co-authored-by: Mads Marquart <mads@marquart.dk>
I took a closer look, I think it could be supported on macOS with https://developer.apple.com/documentation/appkit/nsevent/1530014-deviceid?language=objc, but there is no such thing in UIKit. |
enum GestureSource {
TouchPad,
TouchScreen,
} But generally, I'm not sure that these things differ much... |
Wayland doesn't seem to have equivalent for rotation and double tap, so that's it. It has hold and swipe, which are called long press and swipe on iOS, I think "long press" is clearer than "hold" but both work for me. edit: hold is also called long press on Android: https://developer.android.com/reference/android/view/GestureDetector.OnGestureListener#onLongPress(android.view.MotionEvent) |
I've pointed wayland gestures in the context of existing macOS gestures since you've renamed a bunch. These are for touchpad, not the touchscreen, touchscreen gestures are client side, so it's irrelevant. |
Tested this on my iPad, and fixed a few bugs in the process. The absolute scale for the pinch gesture doesn't match between macOS and iOS, but I'm not sure how to make them, so let's punt on that for now. |
Could you elaborate on what you mean here? Can't we translate into physical sizes of some sort or it's just something else like values are just different and you can't really translate anything? |
Oops, merged before I saw your message. I'm not entirely sure, I guess it's kinda like the |
Delta stuff depends, since there's one discrete and there's one pixel delta, if it's pixel it's scaled, if it's discrete it's not scaled and passed as is, but we have separate types to encode such situation. |
thanks for testing on your device and fixing those bugs! |
I guess the most correct thing would be to have an enum like @mockersf when you do get to supporting this in Bevy, feel free to reach out if the API is inconvenient, or you find a way to represent the data correctly, then we can change it in Winit. |
CHANGELOG.md
if knowledge of this change could be valuable to usersSupport existing macOS gestures on iOS
TouchpadMagnify
toPinchGesture
,SmartMagnify
toDoubleTapGesture
andTouchpadRotate
toRotationGesture
. Those were supported only on macOS, when adding iOS support it feels better to have more generic namesDoubleTapGesture
is a discrete gesture (one event once detection is finished) that can be configured.PinchGesture
andRotationGesture
are continuous gestures (events for each incremental update) with data.