From b7a9c35f31dcf83f8f8e8c19c8155ff44c0e5104 Mon Sep 17 00:00:00 2001 From: Filip Leitner Date: Mon, 5 Feb 2024 09:30:02 +0100 Subject: [PATCH] refactor: Update layer position list when composition is loaded --- .../components/compositions/compositions-parser.service.ts | 1 + .../src/components/compositions/compositions.service.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/projects/hslayers/src/components/compositions/compositions-parser.service.ts b/projects/hslayers/src/components/compositions/compositions-parser.service.ts index 292a8d7521..eed3636909 100644 --- a/projects/hslayers/src/components/compositions/compositions-parser.service.ts +++ b/projects/hslayers/src/components/compositions/compositions-parser.service.ts @@ -475,6 +475,7 @@ export class HsCompositionsParserService { this.hsLayoutService.setMainPanel('layermanager'); } this.composition_edited = false; + this.hsLayerManagerService.updateLayerListPositions(); this.hsEventBusService.compositionLoads.next(responseData); } diff --git a/projects/hslayers/src/components/compositions/compositions.service.ts b/projects/hslayers/src/components/compositions/compositions.service.ts index ee8105120b..f9883c363f 100644 --- a/projects/hslayers/src/components/compositions/compositions.service.ts +++ b/projects/hslayers/src/components/compositions/compositions.service.ts @@ -16,6 +16,7 @@ import {HsConfig} from '../../config.service'; import {HsEndpoint} from '../../common/endpoints/endpoint.interface'; import {HsEventBusService} from '../core/event-bus.service'; import {HsLanguageService} from '../language/language.service'; +import {HsLayerManagerService} from '../layermanager/layermanager.service'; import {HsLogService} from '../../common/log/log.service'; import {HsMapCompositionDescriptor} from './models/composition-descriptor.model'; import {HsShareUrlService} from '../permalink/share-url.service'; @@ -47,6 +48,7 @@ export class HsCompositionsService { private hsCompositionsMapService: HsCompositionsMapService, private hsEventBusService: HsEventBusService, private hsToastService: HsToastService, + private hsLayerManagerService: HsLayerManagerService, ) { this.hsEventBusService.compositionEdits.subscribe(() => { this.hsCompositionsParserService.composition_edited = true; @@ -374,6 +376,7 @@ export class HsCompositionsService { this.hsMapService.addLayer(layers[i], DuplicateHandling.RemoveOriginal); } this.hsMapService.fitExtent(response.data.nativeExtent); + this.hsLayerManagerService.updateLayerListPositions(); } else { this.$log.log('Error loading permalink layers'); } @@ -411,6 +414,7 @@ export class HsCompositionsService { this.hsMapService.addLayer(layers[i], DuplicateHandling.IgnoreNew); } localStorage.removeItem('hs_layers'); + this.hsLayerManagerService.updateLayerListPositions(); } }