Added player popup
This commit is contained in:
@@ -133,6 +133,14 @@ if ( players ) {
|
||||
|
||||
const playerMarker = L.marker(playersPosition, { icon: playerIcon }).addTo(map)
|
||||
playerMarker.addTo(layerGroups['players'])
|
||||
|
||||
const popupContent = `
|
||||
<strong class="title">
|
||||
${players.title}
|
||||
</strong>
|
||||
<p>${players.description}</p>
|
||||
`;
|
||||
playerMarker.bindPopup(popupContent).openPopup();
|
||||
}
|
||||
|
||||
map.fitBounds(layer.getBounds());
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { deepMap, onMount, task } from 'nanostores'
|
||||
import type { MapMarker } from '../../types/Leaflet';
|
||||
import type { MapMarker, PlayerMarker } from '../../types/Leaflet';
|
||||
|
||||
export const $world = deepMap({
|
||||
markers: [] as MapMarker[],
|
||||
players: {} as MapMarker,
|
||||
players: {} as PlayerMarker,
|
||||
})
|
||||
|
||||
// Fetch initial data
|
||||
|
||||
Reference in New Issue
Block a user