@artstesh/maps 4.1.30 → 4.1.32

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.
@@ -1363,6 +1363,7 @@ class FeatureModificationService {
1363
1363
  });
1364
1364
  }
1365
1365
  clearInteraction(layer) {
1366
+ layer?.getSource()?.clear();
1366
1367
  if (this.modify)
1367
1368
  this.map?.removeInteraction(this.modify);
1368
1369
  if (this.translate)
@@ -2697,6 +2698,7 @@ class MapPlateComponent extends DestructibleComponent {
2697
2698
  this.mapFactory = mapFactory;
2698
2699
  this.registrator = registrator;
2699
2700
  this.detector = detector;
2701
+ this.renderTryCount = 0;
2700
2702
  this.osmUrl = '';
2701
2703
  this.drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
2702
2704
  this._settings = new MapSettings();
@@ -2711,7 +2713,7 @@ class MapPlateComponent extends DestructibleComponent {
2711
2713
  this._settings = value;
2712
2714
  this.setOsm();
2713
2715
  }
2714
- ngOnInit() {
2716
+ initializeMap() {
2715
2717
  useGeographic();
2716
2718
  this.map = this.mapFactory.build(this._settings);
2717
2719
  this.map.setTarget(this.elementRef.nativeElement);
@@ -2725,6 +2727,20 @@ class MapPlateComponent extends DestructibleComponent {
2725
2727
  });
2726
2728
  this.setOsm();
2727
2729
  }
2730
+ ngAfterViewInit() {
2731
+ const mapContainer = this.elementRef.nativeElement;
2732
+ const checkContainerSize = () => {
2733
+ const { clientWidth, clientHeight } = mapContainer;
2734
+ if (clientWidth > 0 && clientHeight > 0) {
2735
+ this.initializeMap();
2736
+ }
2737
+ else {
2738
+ console.error("Map's container is not rendered yet or has zero size. Trying again in 100 ms.");
2739
+ setTimeout(checkContainerSize, 20 * ++this.renderTryCount); // Проверка каждые 100 мс
2740
+ }
2741
+ };
2742
+ checkContainerSize();
2743
+ }
2728
2744
  setOsm() {
2729
2745
  if (!this.map)
2730
2746
  return;