-
I'm trying to figure out how to call Maplibre's flyTo function from svelte-maplibre. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
3 options here, depending on your needs:
<script>
import { MapLibre } from 'svelte-maplibre'
let map;
$: map?.flyTo(newCoords);
</script>
<MapLibre bind:map>
<!-- other stuff in here -->
</MapLibre>
|
Beta Was this translation helpful? Give feedback.
-
Awesome! Thanks!! |
Beta Was this translation helpful? Give feedback.
3 options here, depending on your needs:
map
prop which gets set to the MapLibre instance, so you canMapLibre exposes the
map
on its slot too, so if your buttons are in a control or something you can use that. The Controls example does it this way.svelte-maplibre/src/routes/examples/controls/+page.svelte
Line 24 in 3b1c9d8
The map events all include the map instance in their data, so you could reference
event.detail.map
in any event handler.