From d8730e77ad142f3e721ef966bb465bd591a0d94f Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Wed, 23 Feb 2022 11:57:36 +0100 Subject: [PATCH] AW-3573 --- .../aol/layer-list/layer-list.component.html | 2 +- .../aol/layer-list/layer-list.component.ts | 1 + .../layer-switcher.component.html | 7 ++++++ .../layer-switcher.component.ts | 2 ++ .../src/fm-map/reducers/map.reducer.ts | 24 ++++++++++++------- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/projects/common-map/src/fm-map/components/aol/layer-list/layer-list.component.html b/projects/common-map/src/fm-map/components/aol/layer-list/layer-list.component.html index d39b4d4..9b6ddd1 100644 --- a/projects/common-map/src/fm-map/components/aol/layer-list/layer-list.component.html +++ b/projects/common-map/src/fm-map/components/aol/layer-list/layer-list.component.html @@ -13,7 +13,7 @@ - +
diff --git a/projects/common-map/src/fm-map/components/aol/layer-list/layer-list.component.ts b/projects/common-map/src/fm-map/components/aol/layer-list/layer-list.component.ts index 4f90e86..2da9cb9 100644 --- a/projects/common-map/src/fm-map/components/aol/layer-list/layer-list.component.ts +++ b/projects/common-map/src/fm-map/components/aol/layer-list/layer-list.component.ts @@ -10,6 +10,7 @@ import { IItemLayer } from '../../../models/item.layer'; export class LayerListComponent { @Input() itemLayers: IItemLayer[] = []; @Input() baseLayers: boolean = false; + @Input() dataLayers: boolean = false; @Output() onToggleVisibility = new EventEmitter(); @Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>(); @Output() onDelete = new EventEmitter(); diff --git a/projects/common-map/src/fm-map/components/layer-switcher/layer-switcher.component.html b/projects/common-map/src/fm-map/components/layer-switcher/layer-switcher.component.html index cc8943d..6b27e9d 100644 --- a/projects/common-map/src/fm-map/components/layer-switcher/layer-switcher.component.html +++ b/projects/common-map/src/fm-map/components/layer-switcher/layer-switcher.component.html @@ -19,6 +19,13 @@
+ +
diff --git a/projects/common-map/src/fm-map/components/layer-switcher/layer-switcher.component.ts b/projects/common-map/src/fm-map/components/layer-switcher/layer-switcher.component.ts index 67ca0b0..8394d03 100644 --- a/projects/common-map/src/fm-map/components/layer-switcher/layer-switcher.component.ts +++ b/projects/common-map/src/fm-map/components/layer-switcher/layer-switcher.component.ts @@ -16,6 +16,7 @@ export class LayerSwitcher implements OnInit,OnChanges{ public showLayerSwitcher:Observable; public overlayLayers: Observable>; public selectedOverlayLayer: Observable; + public selectedItemLayer$: Observable; public baseLayers: Observable>; public selectedBaseLayer: Observable; @@ -27,6 +28,7 @@ export class LayerSwitcher implements OnInit,OnChanges{ this.selectedOverlayLayer = this.store.select(mapReducers.selectGetSelectedOverlayLayer); this.baseLayers = this.store.select(mapReducers.selectGetBaseLayers); this.selectedBaseLayer = this.store.select(mapReducers.selectGetSelectedBaseLayer); + this.selectedItemLayer$ = this.store.select(mapReducers.selectGetSelectedItemLayer) this.showLayerSwitcher = this.store.select(mapReducers.selectGetShowLayerSwitcher); } diff --git a/projects/common-map/src/fm-map/reducers/map.reducer.ts b/projects/common-map/src/fm-map/reducers/map.reducer.ts index c23aed0..06c14b4 100644 --- a/projects/common-map/src/fm-map/reducers/map.reducer.ts +++ b/projects/common-map/src/fm-map/reducers/map.reducer.ts @@ -385,17 +385,25 @@ export function reducer(state = initialState, action: mapActions.Actions | commo } case mapActions.SETVISIBILITY: { let a = action as mapActions.SetVisibility; - let newLayers = state.overlayLayers.slice(0); - let i = state.overlayLayers.indexOf(a.itemLayer); - newLayers[i].visible = a.visibility; - return tassign(state, { overlayLayers: newLayers }); + if(state.selectedItemLayer == a.itemLayer) { + return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{visible:a.visibility})}); + } else { + let newLayers = state.overlayLayers.slice(0); + let i = state.overlayLayers.indexOf(a.itemLayer); + newLayers[i].visible = a.visibility; + return tassign(state, { overlayLayers: newLayers }); + } } case mapActions.SETOPACITY: { let a = action as mapActions.SetOpacity; - let newLayers = state.overlayLayers.slice(0); - let i = state.overlayLayers.indexOf(a.itemLayer); - newLayers[i].opacity = a.opacity; - return tassign(state, { overlayLayers: newLayers }); + if(state.selectedItemLayer == a.itemLayer) { + return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{opacity:a.opacity})}); + } else { + let newLayers = state.overlayLayers.slice(0); + let i = state.overlayLayers.indexOf(a.itemLayer); + newLayers[i].opacity = a.opacity; + return tassign(state, { overlayLayers: newLayers }); + } } case mapActions.SETLAYERINDEX: { let a = action as mapActions.SetLayerIndex;