pixi-viewport
pixi-viewport copied to clipboard
Pinch zoom issues on firefox mobile
probably related to #93
Im using pixi viewport in https://www.malmap.net/. Pinch zoom works fine in chrome mobile but not firefox. The first time you pinch zoom it works fine, however every time after that it doesn't register it as a pinch, and spazzes out between the two touch points.
Here is my code for the viewport: https://github.com/platers/MAL-Map/blob/5c8c7cac18da8aa29b425669590fa8afaf632748/svelte/src/Canvas.svelte#L36
Did you track this down? I haven't worked much in firefox mobile but I think it worked in firefox last time I checked.
Still don't know why it happens :/
I can confirm this issue in one of my projects as well and can also confirm the same issue with site posted by @platers above.
From my end, the problem does not always appear. And the zoom mostly works fine once I get past the first pinch. By making a fast pinch right after the site loaded I can reproduce the issue like 90% of the time though.
I am using Firefox Nightly 99.0a1
We're getting a similar sounding issue on Android in general (Chrome/Firefox). I think touch/pointer end events are getting lost. I think this because I can get the viewport into a state where one finger is still pinch zooming and I can find the point it thinks the other finger is by watching for the place where the zoom changes direction.
Done some digging. In Chrome Android at least, the pointerId
s are reused (I added consoles to the InputManager
), and they aren't on iOS, and get
and remove
seem to be called out of order, so points can be remove or added twice.
UPDATE:
I think the issues comes from PIXI, pointerId
is the identifier
of the first Touch
in changedTouches
, so if there are many changed touches they clobber each other 'cos the pointerId
is the same.
UPDATE 2:
The problem comes from @pixi/interations
incorrectly reusing InterationData
object. I removed the object pool and always created a new object now everything works fine.
Hello, I also encountered the same problem, how to operate the last, I am not familiar with the first time
UPDATE 2:
The problem comes from
@pixi/interations
incorrectly reusingInterationData
object. I removed the object pool and always created a new object now everything works fine.
Hey Peter, do you mind explaining in more detail how you accomplished this? I am stuck with this frustrating issue. Do you mind providing some code to fix this. Do you have to modify the library code?
@szge Made a local copy of pixi/interaction then I removed this.interactionDataPool
from the InteractionManager
class in dist/esm/interaction.mjs
. Instead of pop an InteractionData
from a pool, just create a new one.
@davidfig I have the same issue, do you have any idea to fix it? @dj-foxxy Could you please post example code?
I happened in android chrome environment