Last active
January 19, 2022 21:50
-
-
Save jkeefe/aeecbfb22ac4282381f7e06992c8ee50 to your computer and use it in GitHub Desktop.
When a marker is not the center of the map, first zoom in without panning zooms to marker (Mapbox)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let dragged_once = false; | |
map.on('dragstart', () => { | |
dragged_once = true; | |
}); | |
map.on('zoomend', () => { | |
if (!dragged_once) { | |
map.easeTo({ | |
center: label_list[0].lngLat, | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment