@artstesh/maps 6.1.9 → 6.1.11

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.
@@ -1440,6 +1440,7 @@ class FeatureModificationService {
1440
1440
  });
1441
1441
  }
1442
1442
  clearInteraction(layer) {
1443
+ layer?.getSource()?.clear();
1443
1444
  if (this.modify)
1444
1445
  this.map?.removeInteraction(this.modify);
1445
1446
  if (this.translate)
@@ -2803,6 +2804,7 @@ class MapPlateComponent extends DestructibleComponent {
2803
2804
  mapFactory;
2804
2805
  registrator;
2805
2806
  detector;
2807
+ renderTryCount = 0;
2806
2808
  map;
2807
2809
  osmUrl = '';
2808
2810
  drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
@@ -2822,7 +2824,7 @@ class MapPlateComponent extends DestructibleComponent {
2822
2824
  this._settings = value;
2823
2825
  this.setOsm();
2824
2826
  }
2825
- ngOnInit() {
2827
+ initializeMap() {
2826
2828
  useGeographic();
2827
2829
  this.map = this.mapFactory.build(this._settings);
2828
2830
  this.map.setTarget(this.elementRef.nativeElement);
@@ -2836,6 +2838,20 @@ class MapPlateComponent extends DestructibleComponent {
2836
2838
  });
2837
2839
  this.setOsm();
2838
2840
  }
2841
+ ngAfterViewInit() {
2842
+ const mapContainer = this.elementRef.nativeElement;
2843
+ const checkContainerSize = () => {
2844
+ const { clientWidth, clientHeight } = mapContainer;
2845
+ if (clientWidth > 0 && clientHeight > 0) {
2846
+ this.initializeMap();
2847
+ }
2848
+ else {
2849
+ console.error("Map's container is not rendered yet or has zero size. Trying again in 100 ms.");
2850
+ setTimeout(checkContainerSize, 20 * ++this.renderTryCount); // Проверка каждые 100 мс
2851
+ }
2852
+ };
2853
+ checkContainerSize();
2854
+ }
2839
2855
  onDestroy = () => {
2840
2856
  this.registrator.down();
2841
2857
  };