diff --git a/frontend/static/frontend/images/favicon.ico b/frontend/static/frontend/images/favicon.ico new file mode 100644 index 0000000..46e9340 Binary files /dev/null and b/frontend/static/frontend/images/favicon.ico differ diff --git a/frontend/static/frontend/ts/main.ts b/frontend/static/frontend/ts/main.ts index a1082a6..9414d64 100644 --- a/frontend/static/frontend/ts/main.ts +++ b/frontend/static/frontend/ts/main.ts @@ -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"], ""]); + } + }); }); diff --git a/frontend/templates/frontend/base.html b/frontend/templates/frontend/base.html index 76500d8..d5c78b9 100644 --- a/frontend/templates/frontend/base.html +++ b/frontend/templates/frontend/base.html @@ -21,6 +21,7 @@ crossorigin="anonymous" referrerpolicy="no-referrer" /> + {% block extra_css %}{% endblock %}