-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
map.on() and passive: false events #6679
Comments
This seems like expected behavior to me. The documentation for
So if TouchZoomRotateHandler is disabled, there's nothing for Can you say more about what you're trying to accomplish? |
I'm trying to implement dragging of a feature like in the official drag
point example. My problem is that if the user accidentally does a pinch
instead of a drag the viewport will zoom with no way to go back.
My best idea so far is to check for originalEvent.scale!=1 and do an
originalEvent.preventDefault, but even this can sometimes zoom the UI.
I'll create an example showing this behavior.
…On 2018. May 16., Wed at 17:22, John Firebaugh ***@***.***> wrote:
This seems like expected behavior to me. The documentation for
preventDefault says:
Prevents subsequent default processing of the event by the map.
Calling this method will prevent the following default map behaviors:
- On touchstart events, the behavior of DragPanHandler
- On touchstart events, the behavior of TouchZoomRotateHandler
So if TouchZoomRotateHandler is disabled, there's nothing for
preventDefault to do on pinch gestures.
Can you say more about what you're trying to accomplish?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#6679 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAeKj0vY0bacFyV9rpIDbng8b_zueFlKks5tzEQpgaJpZM4UBUO3>
.
|
Do you want TouchZoomRotateHandler disabled all the time, or is disabling that just something you tried to suppress the viewport scaling? |
Yes, the example I've given was just something I created for debugging. I'd like to disable touch zooming only while I'm grabbing a point. Here are the real issues I've run into while setting up events like in "drag-a-point" example:
|
OK, I managed to reproduce the "container escape" bug for touch to zoom. Just try to touch zoom the map in many different directions on an iOS device.
Once the zoom "escaped" the UI is destroyed as there is no way to get back to the original viewport. Silly iOS Safari remembers the viewport even after a page reload. (If you go into the URL bar and press return it'll reset the viewport, but users will probably just press the reload button). |
To trigger the buggy state, try touch zooming around the bottom UI elements, like the i button or the Mapbox logo. |
mapbox-gl-js version: 0.45.0
browser: iOS 11.3
Steps to Trigger Behavior
passive: false
event, liketouchmove
which callse.preventDefault()
Link to Demonstration
full screen: https://03qo50z3rw.codesandbox.io/
https://codesandbox.io/s/03qo50z3rw
Expected Behavior
e.preventDefault()
should disable browser viewport zoomingActual Behavior
The browser window zooms, even with
e.preventDefault()
I tried an alternative,
e.originalEvent.preventDefault()
which seems to work, however the official drag point example usese.preventDefault()
.cc: @jfirebaugh
ref: #6095
pr: #6248
The text was updated successfully, but these errors were encountered: