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 mapState = tassign(state.mapState);
let sb = baseLayers.filter(layer => layer.item.code === mapState.baseLayerCode)[0];
if (baseLayers.length > 0 && mapState.baseLayerCode != "" && sb) {
selectedBaseLayer = sb;
let sb = baseLayers.filter(layer => layer.item.code === mapState.baseLayerCode);
let db = baseLayers.filter(layer => layer.item.data && layer.item.data.default === true);
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;
} else if (baseLayers.length > 0) {
selectedBaseLayer = baseLayers[0];