AW-3573
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
FarmMaps/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma
2022-02-23 11:57:36 +01:00
parent e62c185f35
commit d8730e77ad
5 changed files with 27 additions and 9 deletions

View File

@@ -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;