Open lairdresearch opened 10 months ago
Good point @lairdresearch. We'll add it to our todo list.
Currently, you can get the zoom level from any of the map callback functions, e.g. onMapMoveZoom
. Here's the doc section about them: https://unovis.dev/docs/maps/LeafletMap#map-callbacks.
Fair point -- but I'm bundling this together into a Svelte component and it would make binding to variables a lot easier by just being able to query the current zoom to get started. Currently, I have to wait for zoom to be triggered to get the zoom (which triggers the event) so there's a noticeable delay in initializing some components on the side.
@lairdresearch I see, thanks for the feedback. We'll let you know once the update is ready.
We have functions to control zooming (setZoom, zoomIn, zoomOut) but no function to return the current zoom level of the map. This is hidden in a private variable.
It could be something as simple as:
getZoom() { return this._map.leaflet.getZoom(); }