Implement default baselayer option
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2020-09-09 09:54:50 +02:00
parent ee4e7113d2
commit 6367d3399d

View File

@ -407,9 +407,13 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
} }
var selectedBaseLayer: IItemLayer = null; var selectedBaseLayer: IItemLayer = null;
var mapState = tassign(state.mapState); var mapState = tassign(state.mapState);
let sb = baseLayers.filter(layer => layer.item.code === mapState.baseLayerCode)[0]; let sb = baseLayers.filter(layer => layer.item.code === mapState.baseLayerCode);
if (baseLayers.length > 0 && mapState.baseLayerCode != "" && sb) { let db = baseLayers.filter(layer => layer.item.data && layer.item.data.default === true);
selectedBaseLayer = sb; if (baseLayers.length > 0 && mapState.baseLayerCode != "" && sb.length>0) {
selectedBaseLayer = sb[0];
selectedBaseLayer.visible = true;
} else if (baseLayers.length >0 && db.length>0){
selectedBaseLayer = db[0];
selectedBaseLayer.visible = true; selectedBaseLayer.visible = true;
} else if (baseLayers.length > 0) { } else if (baseLayers.length > 0) {
selectedBaseLayer = baseLayers[0]; selectedBaseLayer = baseLayers[0];