@regionerne/gis-komponent 0.0.110 → 0.0.112

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.
@@ -408,9 +408,23 @@ class LayoutService {
408
408
  _map;
409
409
  mapResizedSubject = new Subject();
410
410
  mapSetSubject = new BehaviorSubject(false);
411
+ _resizeObserver = null;
411
412
  set map(value) {
412
413
  this._map = value;
413
414
  this.mapSetSubject.next(true);
415
+ this._observeMapResize();
416
+ }
417
+ _observeMapResize() {
418
+ if (this._resizeObserver) {
419
+ this._resizeObserver.disconnect();
420
+ }
421
+ const viewport = this._map?.getViewport();
422
+ if (!viewport)
423
+ return;
424
+ this._resizeObserver = new ResizeObserver(() => {
425
+ this.mapResizedSubject.next(true);
426
+ });
427
+ this._resizeObserver.observe(viewport);
414
428
  }
415
429
  async keepWidgetInViewPort(dragPosition, widgetName, widgetHeight, widgetWidth, resizedContainerHeight = null, resizedContainerWidth = null) {
416
430
  //Expanding or changing map size, make sure the widget stays in viewport
@@ -847,6 +861,7 @@ class LayerSelectorComponent {
847
861
  _layerSelectorBodyControl;
848
862
  dialogRef;
849
863
  _dialog = inject(MatDialog);
864
+ _resizeSubscription;
850
865
  _mapFilteredLayerGroupsKeyName = 'mapFilteredLayerGroups';
851
866
  POSITION_STORAGE_KEY = 'layerSelectorPosition';
852
867
  _dmpLayersCacheStoragKey = 'dmpLayersCache';
@@ -863,6 +878,12 @@ class LayerSelectorComponent {
863
878
  .replace('partly', 'Delvis klar til brug') }));
864
879
  }
865
880
  });
881
+ this._resizeSubscription = this._layoutService.mapResizedSubject.subscribe(async () => {
882
+ this.layerSelectorDragPosition = await this._layoutService.keepWidgetInViewPort(this.layerSelectorDragPosition, this.POSITION_STORAGE_KEY, this.collapsed ? WidgetConstants.collapsedHeight : WidgetConstants.layerSelectorHeight, this.collapsed ? WidgetConstants.collapsedWidth : WidgetConstants.layerSelectorWidth);
883
+ });
884
+ }
885
+ ngOnDestroy() {
886
+ this._resizeSubscription?.unsubscribe();
866
887
  }
867
888
  ngOnChanges(changes) {
868
889
  if (changes['profile'] && this.profile) {
@@ -2176,6 +2197,7 @@ class MergeFeaturesService {
2176
2197
  this._selectedMergeFeature?.setGeometry(overlapResult[0].getGeometry());
2177
2198
  const mergedFeature = evt.selected[0].clone();
2178
2199
  mergedFeature.setGeometry(overlapResult[0].getGeometry());
2200
+ mergedFeature.setStyle(this._selectedMergeFeature?.getStyle());
2179
2201
  this._featureHelper.setId(mergedFeature);
2180
2202
  this._drawLayerService.source.addFeature(mergedFeature);
2181
2203
  this._undoRedoService.addStep();
@@ -3076,6 +3098,7 @@ class ToolboxComponent {
3076
3098
  _cursorLayerForDraw;
3077
3099
  _geometrySearchService = inject(GeometrySearchService);
3078
3100
  _polygonCleanupService = inject(PolygonCleanupService);
3101
+ _resizeSubscription;
3079
3102
  drawInteraction;
3080
3103
  get showDocumentSearch() {
3081
3104
  return this.settings?.showDocumentSearch !== false;
@@ -4356,9 +4379,8 @@ class ToolboxComponent {
4356
4379
  this._originalMapHeight = this.map.getSize()[1];
4357
4380
  this._originalMapWidth = this.map.getSize()[0];
4358
4381
  this.bufferInMeters = this.settings.defaultBufferInMeters ?? 0.2;
4359
- this._layoutService.mapResizedSubject.subscribe(async (mapResized) => {
4360
- //Map resized, make sure it stays in viewport
4361
- this.dragPosition = await this._layoutService.keepWidgetInViewPort(this.dragPosition, this._POSITION_STORAGE_KEY, WidgetConstants.toolboxHeight, WidgetConstants.toolboxWidth, this.mapHeight, this.mapWidth);
4382
+ this._resizeSubscription = this._layoutService.mapResizedSubject.subscribe(async () => {
4383
+ this.dragPosition = await this._layoutService.keepWidgetInViewPort(this.dragPosition, this._POSITION_STORAGE_KEY, this.collapsed ? WidgetConstants.collapsedHeight : WidgetConstants.toolboxHeight, this.collapsed ? WidgetConstants.collapsedWidth : WidgetConstants.toolboxWidth);
4362
4384
  });
4363
4385
  this.drawItems = [];
4364
4386
  (this.settings.geometryTypeSettings ?? []).filter(f => f.availableGeometryTypes).forEach(geomSetting => {
@@ -4385,6 +4407,9 @@ class ToolboxComponent {
4385
4407
  this._featureHelper.setTypeId(evt.feature, this.selectedGeometrySetting?.typeId || '');
4386
4408
  });
4387
4409
  }
4410
+ ngOnDestroy() {
4411
+ this._resizeSubscription?.unsubscribe();
4412
+ }
4388
4413
  ngOnChanges(changes) {
4389
4414
  if (changes['profile'] && this.profile) {
4390
4415
  this.collapsed = this.profile.toolbarCollapsed;
@@ -4910,6 +4935,7 @@ class ActiveObjectsComponent {
4910
4935
  _conflictService = inject(ConflictAnalysisSearchProvider);
4911
4936
  _undoRedo = inject(UndoRedoService);
4912
4937
  _dialogService = inject(ConfirmDialogService);
4938
+ _resizeSubscription;
4913
4939
  isZoomedToAll = false;
4914
4940
  features$ = this._drawLayerService.features$;
4915
4941
  collapsed = true;
@@ -4994,6 +5020,12 @@ class ActiveObjectsComponent {
4994
5020
  ngOnInit() {
4995
5021
  this.conflictAnalysisAvailable = !!this._current.gisKomponentSettings.containsCheck && this._current.gisKomponentSettings.containsCheck.enabled &&
4996
5022
  this._current.profile.layerGroups.flatMap(lg => lg.layers).some(l => l.useInConflictAnalysis);
5023
+ this._resizeSubscription = this._layoutService.mapResizedSubject.subscribe(async () => {
5024
+ this.dragPosition = await this._layoutService.keepWidgetInViewPort(this.dragPosition, this.POSITION_STORAGE_KEY, this.collapsed ? WidgetConstants.collapsedHeight : WidgetConstants.activeObjectsHeight, this.collapsed ? WidgetConstants.collapsedWidth : WidgetConstants.activeObjectsWidth);
5025
+ });
5026
+ }
5027
+ ngOnDestroy() {
5028
+ this._resizeSubscription?.unsubscribe();
4997
5029
  }
4998
5030
  endSession() {
4999
5031
  this.sessionDone.emit();
@@ -5244,6 +5276,7 @@ class MapSearchComponent {
5244
5276
  _layoutService = inject(LayoutService);
5245
5277
  _profileService = inject(ProfileService);
5246
5278
  _zoomService = inject(ZoomService);
5279
+ _resizeSubscription;
5247
5280
  ngOnInit() {
5248
5281
  this._layerHelperService.activeLayersChanged
5249
5282
  .subscribe(() => this._addWFSSearchLayers());
@@ -5254,6 +5287,12 @@ class MapSearchComponent {
5254
5287
  this.filteredResults = result.filter(result => result.items.length > 0);
5255
5288
  }
5256
5289
  });
5290
+ this._resizeSubscription = this._layoutService.mapResizedSubject.subscribe(async () => {
5291
+ this.dragPosition = await this._layoutService.keepWidgetInViewPort(this.dragPosition, this.POSITION_STORAGE_KEY, this.collapsed ? WidgetConstants.collapsedHeight : WidgetConstants.searchHeight, this.collapsed ? WidgetConstants.collapsedWidth : WidgetConstants.searchWidth);
5292
+ });
5293
+ }
5294
+ ngOnDestroy() {
5295
+ this._resizeSubscription?.unsubscribe();
5257
5296
  }
5258
5297
  ngOnChanges(changes) {
5259
5298
  if (changes['profile'] && this.profile) {
@@ -5425,6 +5464,7 @@ class LegendsListComponent {
5425
5464
  _layoutService = inject(LayoutService);
5426
5465
  _profileService = inject(ProfileService);
5427
5466
  config = inject(GISKOMPONENT_CONFIG);
5467
+ _resizeSubscription;
5428
5468
  map;
5429
5469
  profile;
5430
5470
  filteredLayersDetailed = [];
@@ -5440,6 +5480,9 @@ class LegendsListComponent {
5440
5480
  this.filteredLayersDetailed = result;
5441
5481
  });
5442
5482
  });
5483
+ this._resizeSubscription = this._layoutService.mapResizedSubject.subscribe(async () => {
5484
+ this.dragPosition = await this._layoutService.keepWidgetInViewPort(this.dragPosition, this.POSITION_STORAGE_KEY, this.collapsed ? WidgetConstants.collapsedHeight : WidgetConstants.legendsHeight, this.collapsed ? WidgetConstants.collapsedWidth : WidgetConstants.legendsWidth);
5485
+ });
5443
5486
  }
5444
5487
  ngOnChanges(changes) {
5445
5488
  this._layoutService.mapResizedSubject.subscribe(async () => {
@@ -5454,6 +5497,7 @@ class LegendsListComponent {
5454
5497
  }
5455
5498
  }
5456
5499
  ngOnDestroy() {
5500
+ this._resizeSubscription?.unsubscribe();
5457
5501
  if (this._legendsListBodyControl) {
5458
5502
  this.map.removeControl(this._legendsListBodyControl);
5459
5503
  }