-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Gestures InputEvents #36953
base: master
Are you sure you want to change the base?
Gestures InputEvents #36953
Conversation
c913fdb
to
3a5c221
Compare
Looks good but I have a couple of points to discuss.
|
|
Awesome! InputEventMultiScreenDrag should be renamed to InputEventScreenPan since
|
I changed the names but forgot about it, here is how I changed them:
I tried to keep the consistency with the already existing InputEvents (e.g. InputEventMagnifyGesture and InputEventScreenDrag). |
a5a35a4
to
8ad972d
Compare
I would definitely not suggest that we should force users to pick their own threshold values, but if we can find some very sane defaults I would prefer this option, and leave the option for users to modify them somewhere in the Android project settings. Detecting pinch & twist at the same time is common in my opinion, but I'd like more discussion about this point from other developers who've worked with gestures (my experience might be biased to my use cases). |
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.
Make sure you squash all the commits eventually
8ad972d
to
47a35e7
Compare
…entMultiScreenDrag for Android
47a35e7
to
4592df1
Compare
Wouldn't it be better to give more attributes and methods to InputEventScreenDrag class instead of having InputEventGesture, InputEventMultiScreenDrag, InputEventTwistGesture, InputEventPinchGesture, InputEventMagnifyGesture, InputEventPanGesture ? Whatever the gesture is, the InputEventScreenDrag is always emitted. |
@jeremyz the gestures should happen alongside other events but not replace them, so the drag event is always emitted. Regardless, I don't think adding parameters to the drag event would be ideal since for example you would never have a pinch gesture with only one tap. Anyways @Federico-Ciuffardi , in my opinion we should replace the multi drag event with a pan gesture. As it stands, I'm not even sure whether it does the averaging math to behave like a pan or just a useless wrapper for multiple events (it's not like we need InputEventMultiKey) |
@nathanwfranke sure, I did rethink a bit my position since my writing. |
Osx gestures should be removed since they are native only. This implementation should be multiplatform and replace it. Edit: I see now that this pr implements os_android which is bad. All this math should be done the same on all platforms |
I was at first a bit puzzled by your answer, but your Edit is spot on ! |
It does the averaging math to behave like a pan. With that out of the way I will try to explain the reason why I think the multi drag event is valuable an not just a "InputEventMultiKey". When I was making games, many times I needed to move the camera while Interacting with the game (e.g. selecting and moving units on a RTS) so my solution to avoid having a "toggle between camera and interact mode" button and to be constantly pressing that button was to handle:
So I found useful to have a If you find it useful, I (or anyone who wants to) could try to add the So, what do you think about this? Also remember that you could check out Godot Touch Input Manager to see |
I've checked your 3 repos and the way basic InputEvent* are generated from native code under platform/**/*. It seems to me that your code in InputManager should merge into Inputfilter#parse_input_event_impl, it is a singleton class that deals with InputEvents, that way your event analysis and gesture event emission would be shared by all the supported platforms. I think you should define 3 new InputEvent classes Naming follows the @nathanwfranke ? |
It would have been cool to support windows and Linux as well, because it was supporting Windows' Gestures as well. |
Addresses the issue #13139 (just for android) by implementing the following InputEvents from https://github.com/Federico-Ciuffardi/Godot-Touch-Input-Manager: