pixi-viewport icon indicating copy to clipboard operation
pixi-viewport copied to clipboard

Pinch zoom issues on firefox mobile

Open platers opened this issue 2 years ago • 9 comments

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

platers avatar Jan 17 '22 16:01 platers

Did you track this down? I haven't worked much in firefox mobile but I think it worked in firefox last time I checked.

davidfig avatar Feb 05 '22 16:02 davidfig

Still don't know why it happens :/

platers avatar Feb 05 '22 16:02 platers

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

lukaskleinschmidt avatar Mar 08 '22 10:03 lukaskleinschmidt

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.

dj-foxxy avatar Sep 26 '22 09:09 dj-foxxy

Done some digging. In Chrome Android at least, the pointerIds 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.

dj-foxxy avatar Sep 26 '22 10:09 dj-foxxy

Hello, I also encountered the same problem, how to operate the last, I am not familiar with the first time

jialongsu avatar Oct 12 '22 03:10 jialongsu

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.

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 avatar Jan 22 '23 19:01 szge

@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.

dj-foxxy avatar Jan 23 '23 11:01 dj-foxxy

@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

0oooooooo0 avatar Aug 10 '23 05:08 0oooooooo0