-
Notifications
You must be signed in to change notification settings - Fork 15
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
Pausing impetus causes it to preventDefault on document #7
Comments
@iest the desired effect was to stop panning during the 2-finger pinch-zoom. If we remove I tried |
@iest can you possibly show a test case code with the problem? That will be easier for me to track down the problem. I am thinking if it is possible to disable impetus manually and track it's shift during pinch-zoom, or maybe disable it in |
This seems related to my issue #13 -- perhaps we should look into refactoring this impetus library into one with less issues. |
✋ I'm having the exact same issue. I have a tiled map rendered on a canvas and after pinching on mobile the document cannot be scrolled until tapping/scrolling the map again. You can see the issue live here for example: https://market.decentraland.org/parcels/13/2/detail |
I'm using pan-zoom to help with pinch/panning/zooming a tiled image on a page (a map). It works very well, however I ran into a weird issue...
Problem
When on a touch device and following a pinch on the pan-zoom'd element, the outer document does not respond to pinch or pan gestures — so the page becomes un-scrollable. If you tap inside the element following the pinch, it's then possible to pinch/scroll the page as you'd expect.
I tracked the issue down to how impetus is used:
So when impetus gets a
touchstart
event on the source element, it adds document-level event listeners: one fortouchmove
(wheree.preventDefault
is called), and one fortouchend
which removes the document listeners.The problem comes down to what happens with touch-pinch module: It's
touchstart
event listener on the source element is called at the same time as impetus' — however when pan-zoom gets thestart
event from touch-pinch, we callimpetus.pause()
. Impetus has already set up it's document event listeners at this point because it already detected the event, but doesn't have a chance to tear them down.Although
impetus.resume()
is called when the pinch is ended, it's too late as it's after thetouchend
event has been fired on the source element — so the document-level, preventDefault-calling event listeners remain.Solution
Removing the calls to impetus'
pause
andresume
methods solves it, and doesn't seem to have any bad side-effects. In fact, it seems to also add support for 2-finger panning...?Hope this all makes sense... I'd open a pull request but figured you paused/resumed impetus for a reason.
Anyway, thanks for the great lib!
The text was updated successfully, but these errors were encountered: