Make templating more responsive
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma
2020-04-17 08:01:39 +02:00
parent be4cbd36d1
commit da0534e928
7 changed files with 44 additions and 56 deletions

View File

@@ -43,7 +43,6 @@ export interface State {
panelVisible: boolean,
panelCollapsed: boolean,
selectedFeature: Feature,
clickedFeature: Feature,
selectedItem:IItem,
clearEnabled: boolean,
searchCollapsed: boolean,
@@ -80,7 +79,6 @@ export const initialState: State = {
panelVisible: false,
panelCollapsed: false,
selectedFeature: null,
clickedFeature: null,
selectedItem: null,
clearEnabled: false,
searchCollapsed: true,
@@ -139,10 +137,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
}
}
}
return tassign(state, {
panelVisible: true,
clearEnabled: true,
searchMinified: true,
return tassign(state, {
features: a.features,
extent:extent
});
@@ -150,16 +145,9 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
case mapActions.SELECTFEATURE: {
let a = action as mapActions.SelectFeature;
return tassign(state, {
selectedFeature: state.selectedItem?state.selectedFeature: a.feature,
clickedFeature:null
selectedFeature: state.selectedItem?state.selectedFeature: a.feature
});
}
case mapActions.CLICKFEATURE: {
let a = action as mapActions.ClickFeature;
return tassign(state, {
clickedFeature: a.feature
});
}
}
case mapActions.SELECTITEM: {
return tassign(state, {
selectedItem: null,
@@ -270,9 +258,13 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
let a = action as mapActions.StartSearch;
return tassign(state, {
selectedItem: null,
features:[],
selectedItemLayer:null,
queryState: tassign(a.queryState),
searchCollapsed: false,
panelVisible: true,
clearEnabled: true,
searchMinified: true,
});
}
case mapActions.DOQUERY: {
@@ -288,7 +280,6 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
return tassign(state, {
panelVisible: true,
selectedFeature: a.feature,
clickedFeature:null,
extent: a.feature.getGeometry().getExtent(),
searchCollapsed: false,
clearEnabled:true,
@@ -444,7 +435,6 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
selectedItem: null,
selectedItemLayer: null,
selectedFeature: null,
clickedFeature:null,
queryState: newQueryState,
clearEnabled: false,
searchCollapsed: true,
@@ -467,8 +457,8 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
let a = action as mapActions.ShowLayerSwitcher;
return tassign(state,{showLayerSwitcher:a.show});
}
case mapActions.INIT:{
return tassign(state,{setStateCount:0});
case mapActions.CLEAR:{
return tassign(state,{setStateCount:0,features:[],selectedFeature:null,selectedItem:null});
}
default: {
return state;
@@ -482,7 +472,6 @@ export const getFeatures = (state: State) => state.features;
export const getPanelVisible = (state: State) => state.panelVisible;
export const getPanelCollapsed = (state: State) => state.panelCollapsed;
export const getSelectedFeature = (state: State) => state.selectedFeature;
export const getClickedFeature = (state: State) => state.clickedFeature;
export const getSelectedItem = (state: State) => state.selectedItem;
export const getQueryState = (state: State) => state.queryState;
export const getClearEnabled = (state: State) => state.clearEnabled;
@@ -508,7 +497,6 @@ export const selectGetFeatures = createSelector(selectMapState, getFeatures);
export const selectGetPanelVisible = createSelector(selectMapState, getPanelVisible);
export const selectGetPanelCollapsed = createSelector(selectMapState, getPanelCollapsed);
export const selectGetSelectedFeature = createSelector(selectMapState, getSelectedFeature);
export const selectGetClickedFeature = createSelector(selectMapState, getClickedFeature);
export const selectGetSelectedItem = createSelector(selectMapState, getSelectedItem);
export const selectGetQueryState = createSelector(selectMapState, getQueryState);
export const selectGetClearEnabled = createSelector(selectMapState, getClearEnabled);