You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to start by appreciating this community and the hard work put into mapbox-gl-js. 🙌
mapbox-gl-js version: ^3.2.0
browser: Chrome Version 122.0.6261.128
Steps to Trigger Behavior
set minZoom and maxZoom to map
add image
add click event to map using map.on('click', layerId, clickHandler)
in clickHandlersetMinZoom & maxZoom to different values, then flyTo centroid with a zoom level that's between the zoom values you just set.
You'll notice it doesn't fly to the given centroid. Kindly note that this behavior isn't consistent; as sometimes it might work, however most of the time it doesn't. In the demo provided, it takes multiple clicks to trigger the bug, but in my app, the bug is the default behavior. I should also mention that it works perfectly fine when flyTo isn't triggered by map.on('click'). Meaning, having a button with a classic onClick function that will execute flyTo (same exact function used in map.on('click)), everything works perfectly. I should also mention that this behavior only surfaced after updating mapbox-gl version to 3.2.0, the previous version I had 2.1 was working perfectly fine.
feels like flyTo stops at a random centroid with a random zoom level
The text was updated successfully, but these errors were encountered:
Nuhasami
changed the title
map.flyTo(...) doesn't fly to the given centroid when triggered inside map.on('click') with map.setMinZoom & map.setMaxZoomMar 20, 2024
I want to start by appreciating this community and the hard work put into mapbox-gl-js. 🙌
mapbox-gl-js version: ^3.2.0
browser: Chrome Version 122.0.6261.128
Steps to Trigger Behavior
minZoom
andmaxZoom
to mapmap.on('click', layerId, clickHandler)
clickHandler
setMinZoom
&maxZoom
to different values, thenflyTo
centroid with a zoom level that's between the zoom values you just set.You'll notice it doesn't fly to the given centroid. Kindly note that this behavior isn't consistent; as sometimes it might work, however most of the time it doesn't. In the demo provided, it takes multiple clicks to trigger the bug, but in my app, the bug is the default behavior. I should also mention that it works perfectly fine when
flyTo
isn't triggered bymap.on('click')
. Meaning, having a button with a classiconClick
function that will executeflyTo
(same exact function used inmap.on('click)
), everything works perfectly. I should also mention that this behavior only surfaced after updatingmapbox-gl
version to3.2.0
, the previous version I had2.1
was working perfectly fine.Link to Demonstration
demo to bug
Expected Behavior
flyTo
given centroid with given zoom levelActual Behavior
feels like
flyTo
stops at a random centroid with a random zoom levelThe text was updated successfully, but these errors were encountered: