feat: add north reset control
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user