add buildings hover. add favicon

This commit is contained in:
Matteo Rosati
2026-02-11 17:09:06 +01:00
parent 335299c670
commit 4c67b10f75
4 changed files with 31 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -18,4 +18,33 @@ map.on("load", () => {
lng: position.coords.longitude,
});
});
// Il layer per gli highlight
map.addLayer({
id: "buildings-highlight", // nome arbitrario del layer
type: "fill",
source: "buildings",
"source-layer": "building",
paint: {
"fill-color": "#41ff44",
"fill-opacity": 1,
},
filter: ["==", ["id"], ""],
});
map.on("mousemove", (ev) => {
const features = map.queryRenderedFeatures(ev.point, {
layers: ["buildings"], // questo e' il layer che c'e' nello style di maptiler
});
if (features && features.length > 0) {
const hoveredId = features[0].id;
if (hoveredId) {
map.setFilter("buildings-highlight", ["==", ["id"], hoveredId]);
}
} else {
map.setFilter("buildings-highlight", ["==", ["id"], ""]);
}
});
});