add buildings hover. add favicon
This commit is contained in:
BIN
frontend/static/frontend/images/favicon.ico
Normal file
BIN
frontend/static/frontend/images/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.8 KiB |
@@ -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"], ""]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user