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, 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"], ""]);
}
});
}); });

View File

@@ -21,6 +21,7 @@
crossorigin="anonymous" crossorigin="anonymous"
referrerpolicy="no-referrer" referrerpolicy="no-referrer"
/> />
<link rel="icon" type="image/x-icon" href="{% static 'frontend/images/favicon.ico' %}">
{% block extra_css %}{% endblock %} {% block extra_css %}{% endblock %}
<script <script
src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js" src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js"

View File

@@ -2,7 +2,7 @@
{% load static %} {% load static %}
{% block title %}Home{% endblock %} {% block title %}ᑀ DroneWars ᑅ{% endblock %}
{% block content %} {% block content %}
<div id="map"></div> <div id="map"></div>