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

This commit is contained in:
Willem Dantuma 2021-04-19 08:43:20 +02:00
parent 0485c163ad
commit dcc24aa149

View File

@ -154,14 +154,15 @@ export class MapEffects {
@Effect() @Effect()
zoomToExtent2$: Observable<Action> = this.actions$.pipe( zoomToExtent2$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.SETFEATURES), ofType(mapActions.SETFEATURES),
map((action: mapActions.SetFeatures) => { switchMap((action: mapActions.SetFeatures) => {
let extent = createEmpty(); let extent = createEmpty();
if (extent) { if (extent) {
for (let f of action.features) { for (let f of action.features) {
extend(extent, (f as Feature).getGeometry().getExtent()); extend(extent, (f as Feature).getGeometry().getExtent());
} }
} if(action.features.length>0) return of(new mapActions.SetExtent(extent));
return new mapActions.SetExtent(extent); }
return EMPTY;
})); }));
@Effect() @Effect()