@artstesh/maps 4.1.31 → 4.1.33

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';
@@ -2698,6 +2698,7 @@ class MapPlateComponent extends DestructibleComponent {
2698
2698
  this.mapFactory = mapFactory;
2699
2699
  this.registrator = registrator;
2700
2700
  this.detector = detector;
2701
+ this.renderTryCount = 0;
2701
2702
  this.osmUrl = '';
2702
2703
  this.drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
2703
2704
  this._settings = new MapSettings();
@@ -2712,7 +2713,7 @@ class MapPlateComponent extends DestructibleComponent {
2712
2713
  this._settings = value;
2713
2714
  this.setOsm();
2714
2715
  }
2715
- ngOnInit() {
2716
+ initializeMap() {
2716
2717
  useGeographic();
2717
2718
  this.map = this.mapFactory.build(this._settings);
2718
2719
  this.map.setTarget(this.elementRef.nativeElement);
@@ -2726,6 +2727,20 @@ class MapPlateComponent extends DestructibleComponent {
2726
2727
  });
2727
2728
  this.setOsm();
2728
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
+ }
2729
2744
  setOsm() {
2730
2745
  if (!this.map)
2731
2746
  return;
@@ -2746,7 +2761,7 @@ MapPlateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
2746
2761
  FeatureService,
2747
2762
  FeatureModificationService,
2748
2763
  ControlsService,
2749
- ], 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 });
2764
+ ], 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 });
2750
2765
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, decorators: [{
2751
2766
  type: Component,
2752
2767
  args: [{ selector: 'art-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
@@ -2760,7 +2775,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2760
2775
  FeatureService,
2761
2776
  FeatureModificationService,
2762
2777
  ControlsService,
2763
- ], 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"] }]
2778
+ ], 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"] }]
2764
2779
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
2765
2780
  type: Input
2766
2781
  }] } });