Fix zoom to extent

This commit is contained in:
Willem Dantuma
2020-04-21 13:22:54 +02:00
parent 4e83bc6158
commit e41c728fb2
2 changed files with 24 additions and 15 deletions

View File

@@ -10,7 +10,7 @@ import {commonActions} from '@farmmaps/common';
import { createSelector, createFeatureSelector } from '@ngrx/store';
import {Feature} from 'ol';
import { createEmpty, extend} from 'ol/extent';
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
@@ -129,18 +129,8 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
}
case mapActions.STARTSEARCHSUCCESS: {
let a = action as mapActions.StartSearchSuccess;
let extent = state.extent;
if (!action.query.bboxFilter) {
extent = createEmpty();
if (extent) {
for (let f of action.features) {
extend(extent, (f as Feature).getGeometry().getExtent());
}
}
}
return tassign(state, {
features: a.features,
extent:extent,
inSearch:false
});
}