leaflet-geoman icon indicating copy to clipboard operation
leaflet-geoman copied to clipboard

Opt-In and Text Layer

Open rbertucat opened this issue 2 years ago β€’ 1 comments

I'm following the Opt-In documentation: https://github.com/geoman-io/leaflet-geoman#opt-in. Everything works as expected except for Text Layers that don't get properly initialized as shown in the example below.

Demo: https://jsfiddle.net/14pgryc3/4/

image

My workaround is to manually recreate the marker.

    if (event.shape === "Text") {
      const marker = event.marker;
      if (marker && marker.getLatLng()) {
        marker.removeFrom(map);
        event.layer = L.marker(marker.getLatLng(), {
          textMarker: true,
          text: event.text,
          pmIgnore: false,
        }).addTo(map);
      }
    }

rbertucat avatar Jun 27 '22 15:06 rbertucat