This is what I'm doing: Clicking a marker on the map to open a side panel and center the map on the marker. The side panel takes up 3/4 of the right side of the screen.
This is what I need to happen: Center the marker according to the 1/4 of the viewport that is left after the panel opens.
I can get the pixel coordinates of the marker and do the calculations of where it needs to translate to while the panel is animating open. The problem is that flyTo()
only accepts LngLatLike
objects and I cannot convert my pixel coordinates to latitude and longitude. Leaflet.js has a function called containerPointToLatLng()
that came in handy before I switched to Mapbox GL.
Given the sofistication of Mapbox GL, despite its newness, I can only imagine this is a possibility. But how?