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
Web Port in iOS Safari doesn't register clicks #1954
Comments
I guess it should be same between touch down and touch up, but may be a different one next time it's down? |
Yeah, on my log above they are consistent for a down-motion-up sequence and then next sequence they get a new number.
In this case they appear to be consecutive but I get a feeling they use all the range of the 64-bit id they have. But yeah, I think the idea is to work only with the assumption that each finger ID is unique for all the finger IDs "active" (simultaneous?) - on screen or just leaving the screen. In the mouse emulation, for the two finger method, can't quite figure the case where one finger is on screen and then a second one is used (for the right click) and then with the second one on screen, the first one is lifted. My guess is we just don't support this, the second finger should only be used for tapping. https://wiki.libsdl.org/SDL2/SDL_TouchFingerEvent I noticed that there's also a timestamp member that could be used if needed. |
Well, following are uses of fingerID:
In regards to the p2, the issue here is that in the current logic, the pressed fingers ares kind of "locked" to certain role. As you mentioned above:
Perhaps the solution may be to remember the finger's role until all of them are released. That is, if you:
And alternate solution is to rely solely on number of fingers. Two examples:
ex 2
|
Yes, this is true, the minor note is
This idea of remembering roles looks more correct - it kinda emulates what Android is doing, like first finger down it reserves the 0 ID, and then second finger is down it reserves the 1 ID, if first finger is released and 0 ID is released and then third finger is down 0 ID is again reserved. This is something that if existed could be reused in a future in AGS touch events, as this would give fingerIDs consistent between platforms. I just wonder if there's something really hard about this, since it sounds like it should be in SDL2 itself, but an alternative reason why it isn't may just be because most of the sdl2 people care primarily for PC gaming.
This reads like it is easier to implement. |
Made a fix that works apparently, not sure how good it is: c9b3152 (it's the second alternative, that simply uses number of fingers) Edit: went and attempted the first idea here master...ericoporto:ags:fix-web-ios-touch Edit: made a PR from this. Can be tested here: https://ericoporto.github.io/agsjs/tst2/ |
Describe the bug
When running our Web port in the iOS Safari browser, clicks are not registered
The reason it appears to be that Touch.identifier works differently in it. The 2013 spec states:
Here is a log after I added three log functions in sys_events.cpp, this is in a simulator, so the mouse is only one finger, I click, move and release I think six times and get this.
AGS Version
it happens on current 3.6.0.45, but curiously it did not happen in an old version.
Game
https://ericoporto.github.io/agsjs/tst/
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It's expected to work
Smartphone:
Additional context
When SDL own touch emulation was used, there was no reliance in fingerId, so it worked with that.
The API from SDL only states that fingerId is unique, and nothing else, so apparently we can't rely on actual values from it - even though on Android it's consistent with both the App and the Web version on different browsers, it appears on other devices this is not guaranteed.
The text was updated successfully, but these errors were encountered: