Open site data from sidebar menu

This commit is contained in:
2024-10-11 16:05:44 +02:00
parent 51fa6a773e
commit 82cf4513b7
3 changed files with 9 additions and 6 deletions

View File

@@ -272,8 +272,7 @@ GIS.loadLayer = async function (geoJSON, options, popup = true) {
// Show data from feature in popUp?
const layer = new L.geoJson(geo, {
style: function () {
let style = options;
return style;
return options;
},
onEachFeature: function (feature, layer) {
if (popup) {

View File

@@ -5,6 +5,7 @@ import { SiteSheet } from './components/SiteSheet.js';
import { SiteDocuments } from './components/SiteDocuments.js';
import { SiteSurveys } from './components/SiteSurveys.js';
import { SitePhotos } from './components/SitePhotos.js';
import GIS from './gis.js';
/**
* @namespace UI
@@ -164,10 +165,13 @@ UI.sitesMenu = function (menuListSel, map, sites) {
this.toggleMenu('close-menu');
const menu = document.querySelector(menuListSel);
menu.addEventListener('click', event => {
menu.addEventListener('click', async event => {
if (event.target.nodeName === 'A') {
const layerId = event.target.id;
// zoom to layer...
const layer = sites.customGetLayer(event.target.id);
const layer = sites.customGetLayer(layerId);
const data = await GIS.layerData(layerId);
this.openModal(data, '#site-data');
map.setView(
layer.getBounds().getCenter(),
19,