From 5e3a9af1ddea90be2478ea69dae687c948532db1 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Mon, 21 Nov 2022 23:04:49 +0100 Subject: fix map if OSM layer is not present --- fietsboek/static/osm-monkeypatch.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fietsboek/static/osm-monkeypatch.js b/fietsboek/static/osm-monkeypatch.js index a8310a2..586901a 100644 --- a/fietsboek/static/osm-monkeypatch.js +++ b/fietsboek/static/osm-monkeypatch.js @@ -15,6 +15,13 @@ dieses.mapcanvas = mapcanvas; this.cluster_zoomhistory = []; + // The change function is doing weird things and expects the OSM layer + // to be there, which leads to exceptions and the map not working at + // all if the OSM layer is disabled. We fix this by simply not caring + // about the change function. + // See https://gitlab.com/dunj3/fietsboek/-/issues/27 + this.change = (_) => {}; + // Map anlegen const mycp = 'GPXViewer | '; @@ -76,6 +83,8 @@ keyboard: genugplatz, touchZoom: true, dragging: true, + // Make sure we get the first layer in there + layers: Object.values(this.baseLayers)[0], } ); JB.handle_touch_action(dieses,genugplatz); -- cgit v1.2.3