Explorar o código

provide draw events

Falko Schindler hai 1 ano
pai
achega
6fce331498
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  1. 13 0
      nicegui/elements/leaflet.js

+ 13 - 0
nicegui/elements/leaflet.js

@@ -68,6 +68,19 @@ export default {
         });
       });
     }
+    if (this.map_options.drawControl) {
+      for (const key in L.Draw.Event) {
+        const type = L.Draw.Event[key];
+        this.map.on(type, (e) => {
+          this.$emit(type, {
+            ...e,
+            layer: e.layer ? { ...e.layer, editing: undefined, _events: undefined } : undefined,
+            target: undefined,
+            sourceTarget: undefined,
+          });
+        });
+      }
+    }
     if (this.map_options.drawControl) {
       var drawnItems = new L.FeatureGroup();
       this.map.addLayer(drawnItems);