Refactor with sites from DB...

This commit is contained in:
2025-03-26 16:44:48 +01:00
parent 1067d108e5
commit 1911c0ce9f
2 changed files with 69 additions and 215 deletions

View File

@@ -208,39 +208,6 @@ UI.openPrehistModal = function (data, selector) {
prehistoric.render().then(html => modal.querySelector('#prehist-sheet').innerHTML = html);
modal.classList.add('is-active');
}
/**
* @param {string} menuListSel Menu list selector
* @param {L.Map} map
* @param {L.LayerGroup} sites
*/
UI.sitesMenu = function (menuListSel, map, sites) {
// Close menu if arrow button is clicked...
let markers = [];
map.eachLayer(layer => {
if (layer instanceof L.Marker) {
markers.push(layer);
}
})
const menu = document.querySelector(menuListSel);
menu.addEventListener('click', async event => {
if (event.target.nodeName === 'A') {
const layerId = event.target.id;
const marker = markers.filter(m => m.id === layerId)[0];
// zoom to layer...
const layer = sites.customGetLayer(layerId);
map.setView(
layer.getBounds().getCenter(),
19,
{animate: true, duration: 1, easeLinearity: 0.25}
);
marker.openTooltip();
}
});
}
/**
* Open Spotlight gallery
* @param {string} galleryId The id of the trigger element