@regionerne/gis-komponent 0.0.110 → 0.0.111

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) {
@@ -3076,6 +3097,7 @@ class ToolboxComponent {
3076
3097
  _cursorLayerForDraw;
3077
3098
  _geometrySearchService = inject(GeometrySearchService);
3078
3099
  _polygonCleanupService = inject(PolygonCleanupService);
3100
+ _resizeSubscription;
3079
3101
  drawInteraction;
3080
3102
  get showDocumentSearch() {
3081
3103
  return this.settings?.showDocumentSearch !== false;
@@ -4356,9 +4378,8 @@ class ToolboxComponent {
4356
4378
  this._originalMapHeight = this.map.getSize()[1];
4357
4379
  this._originalMapWidth = this.map.getSize()[0];
4358
4380
  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);
4381
+ this._resizeSubscription = this._layoutService.mapResizedSubject.subscribe(async () => {
4382
+ 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
4383
  });
4363
4384
  this.drawItems = [];
4364
4385
  (this.settings.geometryTypeSettings ?? []).filter(f => f.availableGeometryTypes).forEach(geomSetting => {
@@ -4385,6 +4406,9 @@ class ToolboxComponent {
4385
4406
  this._featureHelper.setTypeId(evt.feature, this.selectedGeometrySetting?.typeId || '');
4386
4407
  });
4387
4408
  }
4409
+ ngOnDestroy() {
4410
+ this._resizeSubscription?.unsubscribe();
4411
+ }
4388
4412
  ngOnChanges(changes) {
4389
4413
  if (changes['profile'] && this.profile) {
4390
4414
  this.collapsed = this.profile.toolbarCollapsed;
@@ -4910,6 +4934,7 @@ class ActiveObjectsComponent {
4910
4934
  _conflictService = inject(ConflictAnalysisSearchProvider);
4911
4935
  _undoRedo = inject(UndoRedoService);
4912
4936
  _dialogService = inject(ConfirmDialogService);
4937
+ _resizeSubscription;
4913
4938
  isZoomedToAll = false;
4914
4939
  features$ = this._drawLayerService.features$;
4915
4940
  collapsed = true;
@@ -4994,6 +5019,12 @@ class ActiveObjectsComponent {
4994
5019
  ngOnInit() {
4995
5020
  this.conflictAnalysisAvailable = !!this._current.gisKomponentSettings.containsCheck && this._current.gisKomponentSettings.containsCheck.enabled &&
4996
5021
  this._current.profile.layerGroups.flatMap(lg => lg.layers).some(l => l.useInConflictAnalysis);
5022
+ this._resizeSubscription = this._layoutService.mapResizedSubject.subscribe(async () => {
5023
+ this.dragPosition = await this._layoutService.keepWidgetInViewPort(this.dragPosition, this.POSITION_STORAGE_KEY, this.collapsed ? WidgetConstants.collapsedHeight : WidgetConstants.activeObjectsHeight, this.collapsed ? WidgetConstants.collapsedWidth : WidgetConstants.activeObjectsWidth);
5024
+ });
5025
+ }
5026
+ ngOnDestroy() {
5027
+ this._resizeSubscription?.unsubscribe();
4997
5028
  }
4998
5029
  endSession() {
4999
5030
  this.sessionDone.emit();
@@ -5244,6 +5275,7 @@ class MapSearchComponent {
5244
5275
  _layoutService = inject(LayoutService);
5245
5276
  _profileService = inject(ProfileService);
5246
5277
  _zoomService = inject(ZoomService);
5278
+ _resizeSubscription;
5247
5279
  ngOnInit() {
5248
5280
  this._layerHelperService.activeLayersChanged
5249
5281
  .subscribe(() => this._addWFSSearchLayers());
@@ -5254,6 +5286,12 @@ class MapSearchComponent {
5254
5286
  this.filteredResults = result.filter(result => result.items.length > 0);
5255
5287
  }
5256
5288
  });
5289
+ this._resizeSubscription = this._layoutService.mapResizedSubject.subscribe(async () => {
5290
+ this.dragPosition = await this._layoutService.keepWidgetInViewPort(this.dragPosition, this.POSITION_STORAGE_KEY, this.collapsed ? WidgetConstants.collapsedHeight : WidgetConstants.searchHeight, this.collapsed ? WidgetConstants.collapsedWidth : WidgetConstants.searchWidth);
5291
+ });
5292
+ }
5293
+ ngOnDestroy() {
5294
+ this._resizeSubscription?.unsubscribe();
5257
5295
  }
5258
5296
  ngOnChanges(changes) {
5259
5297
  if (changes['profile'] && this.profile) {
@@ -5425,6 +5463,7 @@ class LegendsListComponent {
5425
5463
  _layoutService = inject(LayoutService);
5426
5464
  _profileService = inject(ProfileService);
5427
5465
  config = inject(GISKOMPONENT_CONFIG);
5466
+ _resizeSubscription;
5428
5467
  map;
5429
5468
  profile;
5430
5469
  filteredLayersDetailed = [];
@@ -5440,6 +5479,9 @@ class LegendsListComponent {
5440
5479
  this.filteredLayersDetailed = result;
5441
5480
  });
5442
5481
  });
5482
+ this._resizeSubscription = this._layoutService.mapResizedSubject.subscribe(async () => {
5483
+ this.dragPosition = await this._layoutService.keepWidgetInViewPort(this.dragPosition, this.POSITION_STORAGE_KEY, this.collapsed ? WidgetConstants.collapsedHeight : WidgetConstants.legendsHeight, this.collapsed ? WidgetConstants.collapsedWidth : WidgetConstants.legendsWidth);
5484
+ });
5443
5485
  }
5444
5486
  ngOnChanges(changes) {
5445
5487
  this._layoutService.mapResizedSubject.subscribe(async () => {
@@ -5454,6 +5496,7 @@ class LegendsListComponent {
5454
5496
  }
5455
5497
  }
5456
5498
  ngOnDestroy() {
5499
+ this._resizeSubscription?.unsubscribe();
5457
5500
  if (this._legendsListBodyControl) {
5458
5501
  this.map.removeControl(this._legendsListBodyControl);
5459
5502
  }