adb-shared 6.2.17 → 6.2.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2955,7 +2955,6 @@ class PolygonDrawerInput {
2955
2955
  this.subscriptions = new Subscription();
2956
2956
  this.mapId = "" + Math.floor(Math.random() * Date.now());
2957
2957
  this.polygonDraw = false;
2958
- this.shapeLayer = null;
2959
2958
  // ControlValueAccessor
2960
2959
  this.onChange = () => { };
2961
2960
  this.onTouched = () => { };
@@ -2984,19 +2983,25 @@ class PolygonDrawerInput {
2984
2983
  snapMiddle: false
2985
2984
  });
2986
2985
  this.map.on("pm:create", (e) => {
2987
- if (e.shape !== "Polygon" && e.shape !== "Circle")
2986
+ if (e.shape !== 'Polygon' && e.shape !== 'Circle')
2988
2987
  return;
2989
2988
  this.polygonDraw = false;
2990
2989
  this.map.pm.disableDraw();
2991
2990
  this.clearShape();
2992
- this.shapeLayer = e.shape === 'Polygon' ?
2993
- Leaflet__default.geoJson(e.layer.toGeoJSON(), { style: { fillOpacity: 0.5 } }) :
2994
- new Leaflet__default.FeatureGroup([new Leaflet__default.Circle(e.layer.getLatLng(), { radius: e.layer.getRadius() })]);
2991
+ this.shapeLayer = e.layer;
2992
+ if (this.shapeLayer instanceof Leaflet__default.Path) {
2993
+ this.shapeLayer.setStyle({ fillOpacity: 0.5 });
2994
+ }
2995
2995
  this.shapeLayer.interactive = false;
2996
- this.map.addLayer(this.shapeLayer);
2997
2996
  this.map.fitBounds(this.shapeLayer.getBounds());
2998
- this.onChange(e.layer.toGeoJSON());
2999
- this.map.removeLayer(e.layer);
2997
+ const geo = this.shapeLayer.toGeoJSON();
2998
+ if (this.shapeLayer instanceof Leaflet__default.Circle) {
2999
+ geo.properties = {
3000
+ ...geo.properties,
3001
+ radius: this.shapeLayer.getRadius()
3002
+ };
3003
+ }
3004
+ this.onChange(geo);
3000
3005
  });
3001
3006
  }
3002
3007
  renderInitialShape() {