Allow clicks on cells without sources

This commit is contained in:
Eli Ribble 2026-01-15 22:15:29 +00:00
parent e2549f0317
commit 0bb055b391
No known key found for this signature in database

View file

@ -132,7 +132,7 @@ class MapAggregate extends HTMLElement {
'fill-color': '#0dcaf0'
}
});
map.addInteraction("tegola-click-interaction", {
map.addInteraction("tegola-click-mosquito-source", {
type: "click",
target: { layerId: "mosquito_source" },
handler: (e) => {
@ -147,6 +147,36 @@ class MapAggregate extends HTMLElement {
}));
}
});
map.addInteraction("tegola-click-service-request", {
type: "click",
target: { layerId: "service_request" },
handler: (e) => {
const coordinates = e.feature.geometry.coordinates.slice();
const properties = e.feature.properties;
this.dispatchEvent(new CustomEvent("cell-click", {
bubbles: true,
composed: true, // Allows event to cross shadow DOM boundary
detail: {
cell: properties.cell
}
}));
}
});
map.addInteraction("tegola-click-trap", {
type: "click",
target: { layerId: "trap" },
handler: (e) => {
const coordinates = e.feature.geometry.coordinates.slice();
const properties = e.feature.properties;
this.dispatchEvent(new CustomEvent("cell-click", {
bubbles: true,
composed: true, // Allows event to cross shadow DOM boundary
detail: {
cell: properties.cell
}
}));
}
});
});
}