feat: add north reset control

This commit is contained in:
2026-07-21 12:02:48 +01:00
parent 41ded45b09
commit f706128e9c
3 changed files with 61 additions and 0 deletions
+17
View File
@@ -69,6 +69,15 @@ const parcelSearchLayer = new ol.layer.Vector({
const map = new ol.Map({
target: "map",
controls: ol.control
.defaults.defaults({ rotate: false })
.extend([
new ol.control.Rotate({
autoHide: true,
label: createNorthPointerIcon(),
tipLabel: "Reset map orientation to north",
}),
]),
layers: [softBasemapLayer, openStreetMapLayer, satelliteLayer, wmsLayer, parcelSearchLayer],
view: new ol.View({
center: ol.proj.fromLonLat(DEFAULT_CENTER),
@@ -101,6 +110,14 @@ function setSidebarCollapsed(collapsed) {
}
}
function createNorthPointerIcon() {
const icon = document.createElement("img");
icon.className = "north-pointer-icon";
icon.src = "./assets/icons/north-pointer.svg";
icon.alt = "";
return icon;
}
async function searchParcela(event) {
event.preventDefault();