Fix temporal and initial loading
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2021-03-06 14:06:31 +01:00
parent 3d8ce7ee74
commit e8bbb74185

View File

@ -27,6 +27,7 @@ import {FeatureIconService} from '../services/feature-icon.service';
import * as style from 'ol/style'; import * as style from 'ol/style';
import { ItemTypeService,IQueryState } from '@farmmaps/common'; import { ItemTypeService,IQueryState } from '@farmmaps/common';
import { TemporalItemLayer } from '../models/item.layer'
@Injectable() @Injectable()
@ -326,7 +327,7 @@ export class MapEffects {
@Effect() @Effect()
updateLayerValuesOnLayerAddedOrRemoved$: Observable<Action> = this.actions$.pipe( updateLayerValuesOnLayerAddedOrRemoved$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.ADDLAYER,mapActions.REMOVELAYER,mapActions.SELECTITEM), ofType(mapActions.ADDLAYER,mapActions.REMOVELAYER,mapActions.SELECTITEM,mapActions.NEXTTEMPORAL,mapActions.PREVIOUSTEMPORAL,mapActions.TOGGLELAYERVALUESENABLED),
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesX)), withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesX)),
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesY)), withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesY)),
map(([[action,x],y]) => new mapActions.SetLayerValuesLocation(x,y)) map(([[action,x],y]) => new mapActions.SetLayerValuesLocation(x,y))
@ -341,7 +342,12 @@ export class MapEffects {
withLatestFrom(this.store$.select(mapReducers.selectGetOverlayLayers)), withLatestFrom(this.store$.select(mapReducers.selectGetOverlayLayers)),
mergeMap(([[[action, selected], enabled],overlayLayers]) => { mergeMap(([[[action, selected], enabled],overlayLayers]) => {
let layers = []; let layers = [];
if(selected) layers.push(selected); if(selected) {
if(selected instanceof TemporalItemLayer ) {
selected=(selected as TemporalItemLayer).selectedItemLayer;
}
layers.push(selected);
}
overlayLayers.forEach((ol) => { overlayLayers.forEach((ol) => {
if(ol!=selected) layers.push(ol); if(ol!=selected) layers.push(ol);
}); });