Fix click on feature
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma
2020-04-16 15:47:15 +02:00
parent d34a2069d6
commit 3e0cf6d691
7 changed files with 50 additions and 15 deletions

View File

@@ -43,6 +43,7 @@ export interface State {
panelVisible: boolean,
panelCollapsed: boolean,
selectedFeature: Feature,
clickedFeature: Feature,
selectedItem:IItem,
clearEnabled: boolean,
searchCollapsed: boolean,
@@ -79,6 +80,7 @@ export const initialState: State = {
panelVisible: false,
panelCollapsed: false,
selectedFeature: null,
clickedFeature: null,
selectedItem: null,
clearEnabled: false,
searchCollapsed: true,
@@ -148,7 +150,14 @@ 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
selectedFeature: state.selectedItem?state.selectedFeature: a.feature,
clickedFeature:null
});
}
case mapActions.CLICKFEATURE: {
let a = action as mapActions.ClickFeature;
return tassign(state, {
clickedFeature: a.feature
});
}
case mapActions.SELECTITEM: {
@@ -279,6 +288,7 @@ 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,
@@ -434,6 +444,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
selectedItem: null,
selectedItemLayer: null,
selectedFeature: null,
clickedFeature:null,
queryState: newQueryState,
clearEnabled: false,
searchCollapsed: true,
@@ -471,6 +482,7 @@ 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;
@@ -496,6 +508,7 @@ 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);