In my application the edition is something that happens from time to time, so there is no need to have the css and js of geoman loaded from the beginning.
I try to dynamically import the css and js after an user event (button click), but in the form that L.PM is initialized and adds the hooks to Leaflet objects this is not possible.
Doing something like:
loadGeoman().then(function() {
L.PM.initialize({optIn: true});
map.pm = new L.PM.Map(map);
});
does not work either as a lot of errors appears in the console when using the tools, like:
leaflet-geoman.min.js:1 Uncaught TypeError: Cannot read property 'enable' of undefined
at NewClass._createMarker (leaflet-geoman.min.js:1)
at NewClass.fire (Events.js:190)
at NewClass._fireDOMEvent (Map.js:1439)
at NewClass._handleDOMEvent (Map.js:1396)
at HTMLDivElement.handler (DomEvent.js:79)
Probably this is also related with the solutions proposed to #516
In my application the edition is something that happens from time to time, so there is no need to have the css and js of geoman loaded from the beginning.
I try to dynamically import the css and js after an user event (button click), but in the form that L.PM is initialized and adds the hooks to Leaflet objects this is not possible.
Doing something like:
does not work either as a lot of errors appears in the console when using the tools, like:
Probably this is also related with the solutions proposed to #516