Added flyTo support ; targets players

The implementation forces Vue to attach vanilla event handlers, because their VDom doesn't bubble up and there's no way for it to easily communicate with Astro components.
Nanostores aren't an option because .astro files are rendered on the server, so the store can't be used client side (would be nice if it did tho!!!)
This commit is contained in:
Alexis
2023-10-13 17:44:52 +02:00
parent e654d3f96a
commit 085887615a
3 changed files with 179 additions and 176 deletions

View File

@@ -4,15 +4,6 @@ import type { MapCoords, MapMarker } from '../../types/Leaflet';
export const $world = deepMap({
markers: [] as MapMarker[],
players: {} as MapMarker,
lastCoords: {
y: 0,
x: 0,
}
})
export const flyTo = action($world, 'fly-to', (store, coords: MapCoords) => {
store.setKey('lastCoords', coords)
return store.get()
})
// Fetch initial data