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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user