Update index with ThreeJS

+ add id in NPC marker.
This commit is contained in:
troispoils 2024-05-09 17:35:24 +02:00
parent 53c106acce
commit 8b52d69ae9
2 changed files with 14 additions and 1 deletions

View file

@ -6,13 +6,18 @@ export default async function getOverlayNpc() {
var markers = L.markerClusterGroup({
chunkedLoading: true,
disableClusteringAtZoom: 8,
spiderfyOnMaxZoom: false,
showCoverageOnHover: false,
zoomToBoundsOnClick: false
});
const layerNpc = L.layerGroup();
const response = await fetch(url);
const data = await response.json();
let npcLoc = [];
data.forEach((npc) => {
markers.addLayer(L.marker([npc.locy, npc.locx], { icon: customIcons.yellowNpc, id: npc.entityid }).bindPopup(npc.literalValue));
markers.addLayer(L.marker([npc.locy, npc.locx], { icon: customIcons.yellowNpc, id: npc.entityid }).bindPopup(npc.literalValue).on('click', function (a) {
console.log('marker ' + this.options.id);
}));
});
return markers;
} catch (error) {