-
Notifications
You must be signed in to change notification settings - Fork 920
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
Introduce FingerId
#3783
Introduce FingerId
#3783
Conversation
DeviceIdExtWebSys::is_primary()
DeviceIdExtWeb::is_primary()
What's the end goal/motivation with it if you mind sharing? Like it's really not clear how you'd use that aside from touch related stuff? |
Its only used for touch and multi pointer situations. I'm considering implementing this cross-platform for touch only and close this. |
So after looking into how exactly browsers implement Windows is the only OS that supports detecting it via the So I see the following options:
Personally I'm preferring to go with solution 1. |
But if the primary is the first click couldn't it be entirely user detectable? I also don't really understand how one would use it?
But how it's supposed to be utilized by the user and what they'll do with it? Is it some web limitation preventing it detecting multitouch correctly? because you should generally understand the order of touch events, etc? Like in JS world I'd assume that users can just track amount of fingers pressed at the given time or something. |
Yes and no, its not easy to reliably detect on Web, e.g. starting touch point could be outside the canvas etc.
Its only relevant in scenarios where you want to track the primary finger in a multi-touch interaction. This can be common in games, where the primary finger has a certain function that all other fingers don't have, e.g. movement vs shooting. |
@madsmtm @MarijnS95 do you happen to know if something like that exists on ios/android? I'd assume users detect all of that themselves? In general, I don't really mind having solution 1. |
I don't exactly understand what this "primary" pointer is in Web; is it just the first pointer/touch that started? In that case, on Android, you could keep track of the first There's also the mention for
On an unrelated note that sounds very confusing: the first touch controls movement, the second controls aim? I always thought that it was position-based: left half of the screen is moving, right half is panning the camera? In any case it's fully trackable by the user at least. |
Yes.
I have very little experience with games like that, so I can't say much to that. |
On Android an app is usually fullscreen but it doesn't need to be - we should test what happens when a motion gesture enters and exit the app similar to your canvas example! |
DeviceIdExtWeb::is_primary()
FingerId
I went ahead and implemented |
e663e35
to
2890616
Compare
After testing this in winit, the results are somewhat surprising regarding this
Note that if, instead of removing the second finger, another finger is added, non-primary
EDIT: Since this is a platform extension, there's nothing to
Meaning that no motion is primary anymore, if the primary finger was removed after some point in time (while a touch is still ongoing). |
I agree! |
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.
Looks good on the Android side (very minimal)!
If anyone needs it we could expose whether this is the first ("primary") finger going down or the last (""primary""?) finger to go up. This is also easy for the user to track by keeping a rolling count of how many up and down events they have seen though.
(Which could be a little cheaper if we create a separate extension keyed off the difference between Down
and PointerDown
, and (Pointer)Up
respectively, but would have to store a bool
for it anyways)
1736678
to
e1c8242
Compare
e1c8242
to
cc5670c
Compare
This replaces
Touch::id
withTouch::finger_id
and introduces a new typeFingerId
instead.Additionally on Web it exposes
PointerEvent.isPrimary
which tells the user if the finger is the primary/first one in a multi-touch interaction.I also went ahead and implemented this for Windows.
@MarijnS95 pointed out how this could be implemented for Android in #3783 (comment).
But other OSs would have to be polyfilled.
We could potentially expose this directly to the user without a platform specific extension trait if we implement enough platforms.
Followup
Entry in #2875: Firefox emits wrong primary fingers (Bugzilla).