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"], ""]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
crossorigin="anonymous"
|
||||
referrerpolicy="no-referrer"
|
||||
/>
|
||||
<link rel="icon" type="image/x-icon" href="{% static 'frontend/images/favicon.ico' %}">
|
||||
{% block extra_css %}{% endblock %}
|
||||
<script
|
||||
src="https://cdn.jsdelivr.net/npm/htmx.org@2.0.8/dist/htmx.min.js"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
{% load static %}
|
||||
|
||||
{% block title %}Home{% endblock %}
|
||||
{% block title %}ᑀ DroneWars ᑅ{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div id="map"></div>
|
||||
|
||||
Reference in New Issue
Block a user