From 7b9979e9ed72dae1c0dc73df42f5fcb14c10b589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phillip=20M=C3=B6ller?= <36474397+MC-PMOE@users.noreply.github.com> Date: Fri, 5 Apr 2024 18:07:03 +0200 Subject: [PATCH] =?UTF-8?q?Objektzugriff=20erm=C3=B6glichen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Über den Hook wird dem Container eine Referenz zum Mapobjekt hinzugefügt, wodurch der nachträgliche Zugriff ermöglicht wird --- assets/geo_osm.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/assets/geo_osm.js b/assets/geo_osm.js index 35aefaf..a4c115a 100755 --- a/assets/geo_osm.js +++ b/assets/geo_osm.js @@ -19,6 +19,14 @@ var rex_geo_osm = function(addressfields, geofields, id, mapbox_token) { // Karte laden + /* + * Store a reference of the Leaflet map object on the map container, + * so that it could be retrieved from DOM selection. + * https://leafletjs.com/reference-1.3.4.html#map-getcontainer + */ + L.Map.addInitHook(function () { + this.getContainer()._leaflet_map = this; + }); if(mapbox_token=='') { var map = L.map('map-'+id).setView([current_lat, current_lng], 16);