Use refactored styles
This commit is contained in:
@@ -4,7 +4,7 @@ import { IItemLayer,ItemLayer} from '../models/item.layer';
|
||||
import { IMapState} from '../models/map.state';
|
||||
import { IQueryState} from '../models/query.state';
|
||||
import { IPeriodState} from '../models/period.state';
|
||||
import { IStyleCache} from '../models/style.cache';
|
||||
import { IStyles} from '../models/style.cache';
|
||||
import * as mapActions from '../actions/map.actions';
|
||||
import {commonActions} from '@farmmaps/common';
|
||||
import { createSelector, createFeatureSelector } from '@ngrx/store';
|
||||
@@ -53,7 +53,7 @@ export interface State {
|
||||
projection: string,
|
||||
selectedBaseLayer: IItemLayer,
|
||||
selectedOverlayLayer: IItemLayer,
|
||||
styleCache:IStyleCache
|
||||
styles:IStyles
|
||||
}
|
||||
|
||||
export const initialState: State = {
|
||||
@@ -87,7 +87,7 @@ export const initialState: State = {
|
||||
selectedBaseLayer: null,
|
||||
selectedOverlayLayer: null,
|
||||
selectedItemLayer: null,
|
||||
styleCache: {}
|
||||
styles: {}
|
||||
}
|
||||
|
||||
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
|
||||
@@ -315,9 +315,9 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
|
||||
}
|
||||
case mapActions.SETSTYLE:{
|
||||
let a = action as mapActions.SetStyle;
|
||||
let styles = state.styleCache;
|
||||
let styles = tassign(state.styles);
|
||||
styles[a.itemType] = a.style;
|
||||
return tassign(state,{styleCache:styles});
|
||||
return tassign(state,{styles:styles});
|
||||
}
|
||||
default: {
|
||||
return state;
|
||||
@@ -345,6 +345,7 @@ export const getSelectedOverlayLayer = (state: State) => state.selectedOverlayLa
|
||||
export const getQuery = (state: State) => state.query;
|
||||
export const getSelectedItemLayer = (state: State) => state.selectedItemLayer;
|
||||
export const getPeriod = (state:State) => state.period;
|
||||
export const getStyles = (state:State) => state.styles;
|
||||
|
||||
export const selectMapState = createFeatureSelector<State>(MODULE_NAME);
|
||||
export const selectGetMapState= createSelector(selectMapState, getMapState);
|
||||
@@ -367,5 +368,6 @@ export const selectGetSelectedOverlayLayer = createSelector(selectMapState, getS
|
||||
export const selectGetQuery = createSelector(selectMapState, getQuery);
|
||||
export const selectGetSelectedItemLayer = createSelector(selectMapState, getSelectedItemLayer);
|
||||
export const selectGetPeriod = createSelector(selectMapState, getPeriod);
|
||||
export const selectGetStyles = createSelector(selectMapState, getStyles);
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user