@artstesh/maps 5.2.9 → 5.2.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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Injectable, ChangeDetectionStrategy, Input, ViewChild, NgModule } from '@angular/core';
2
+ import { Component, Injectable, ChangeDetectionStrategy, Input, ViewEncapsulation, ViewChild, NgModule } from '@angular/core';
3
3
  import * as i4 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import { Feature, Collection } from 'ol';
@@ -2804,6 +2804,7 @@ class MapPlateComponent extends DestructibleComponent {
2804
2804
  mapFactory;
2805
2805
  registrator;
2806
2806
  detector;
2807
+ renderTryCount = 0;
2807
2808
  map;
2808
2809
  osmUrl = '';
2809
2810
  drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
@@ -2823,7 +2824,7 @@ class MapPlateComponent extends DestructibleComponent {
2823
2824
  this._settings = value;
2824
2825
  this.setOsm();
2825
2826
  }
2826
- ngOnInit() {
2827
+ initializeMap() {
2827
2828
  useGeographic();
2828
2829
  this.map = this.mapFactory.build(this._settings);
2829
2830
  this.map.setTarget(this.elementRef.nativeElement);
@@ -2837,6 +2838,20 @@ class MapPlateComponent extends DestructibleComponent {
2837
2838
  });
2838
2839
  this.setOsm();
2839
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
+ }
2840
2855
  onDestroy = () => {
2841
2856
  this.registrator.down();
2842
2857
  };
@@ -2859,7 +2874,7 @@ class MapPlateComponent extends DestructibleComponent {
2859
2874
  FeatureService,
2860
2875
  FeatureModificationService,
2861
2876
  ControlsService,
2862
- ], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: OsmTileLayerComponent, selector: "art-osm-tile-layer", inputs: ["url", "map"] }, { kind: "component", type: FeatureLayerComponent, selector: "art-feature-layer", inputs: ["settings"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2877
+ ], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{display:block;width:100%;height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: OsmTileLayerComponent, selector: "art-osm-tile-layer", inputs: ["url", "map"] }, { kind: "component", type: FeatureLayerComponent, selector: "art-feature-layer", inputs: ["settings"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2863
2878
  }
2864
2879
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateComponent, decorators: [{
2865
2880
  type: Component,
@@ -2874,7 +2889,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
2874
2889
  FeatureService,
2875
2890
  FeatureModificationService,
2876
2891
  ControlsService,
2877
- ], template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"] }]
2892
+ ], encapsulation: ViewEncapsulation.None, template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{display:block;width:100%;height:100%}\n"] }]
2878
2893
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
2879
2894
  type: Input
2880
2895
  }] } });