@artstesh/maps 1.1.29 → 1.1.31

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.
@@ -1378,11 +1378,12 @@ class FeatureModificationService {
1378
1378
  });
1379
1379
  }
1380
1380
  clearInteraction(layer) {
1381
- var _a, _b;
1381
+ var _a, _b, _c;
1382
+ (_a = layer === null || layer === void 0 ? void 0 : layer.getSource()) === null || _a === void 0 ? void 0 : _a.clear();
1382
1383
  if (this.modify)
1383
- (_a = this.map) === null || _a === void 0 ? void 0 : _a.removeInteraction(this.modify);
1384
+ (_b = this.map) === null || _b === void 0 ? void 0 : _b.removeInteraction(this.modify);
1384
1385
  if (this.translate)
1385
- (_b = this.map) === null || _b === void 0 ? void 0 : _b.removeInteraction(this.translate);
1386
+ (_c = this.map) === null || _c === void 0 ? void 0 : _c.removeInteraction(this.translate);
1386
1387
  }
1387
1388
  }
1388
1389
  FeatureModificationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FeatureModificationService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -2748,6 +2749,7 @@ class MapPlateComponent extends DestructibleComponent {
2748
2749
  this.mapFactory = mapFactory;
2749
2750
  this.registrator = registrator;
2750
2751
  this.detector = detector;
2752
+ this.renderTryCount = 0;
2751
2753
  this.osmUrl = '';
2752
2754
  this.drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
2753
2755
  this._settings = new MapSettings();
@@ -2762,7 +2764,7 @@ class MapPlateComponent extends DestructibleComponent {
2762
2764
  this._settings = value;
2763
2765
  this.setOsm();
2764
2766
  }
2765
- ngOnInit() {
2767
+ initializeMap() {
2766
2768
  useGeographic();
2767
2769
  this.map = this.mapFactory.build(this._settings);
2768
2770
  this.map.setTarget(this.elementRef.nativeElement);
@@ -2776,6 +2778,20 @@ class MapPlateComponent extends DestructibleComponent {
2776
2778
  });
2777
2779
  this.setOsm();
2778
2780
  }
2781
+ ngAfterViewInit() {
2782
+ const mapContainer = this.elementRef.nativeElement;
2783
+ const checkContainerSize = () => {
2784
+ const { clientWidth, clientHeight } = mapContainer;
2785
+ if (clientWidth > 0 && clientHeight > 0) {
2786
+ this.initializeMap();
2787
+ }
2788
+ else {
2789
+ console.error("Map's container is not rendered yet or has zero size. Trying again in 100 ms.");
2790
+ setTimeout(checkContainerSize, 20 * ++this.renderTryCount); // Проверка каждые 100 мс
2791
+ }
2792
+ };
2793
+ checkContainerSize();
2794
+ }
2779
2795
  setOsm() {
2780
2796
  if (!this.map)
2781
2797
  return;