Refactor with sites from DB...
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user