diff --git a/projects/common-map/src/fm-map/actions/map.actions.ts b/projects/common-map/src/fm-map/actions/map.actions.ts index 3b96fe7..521cadb 100644 --- a/projects/common-map/src/fm-map/actions/map.actions.ts +++ b/projects/common-map/src/fm-map/actions/map.actions.ts @@ -302,7 +302,7 @@ export class SetReplaceUrl implements Action { export class SetFeatures implements Action { readonly type = SETFEATURES; - constructor(public features: Array>) { } + constructor(public features: Array>, public zoomToExtent: boolean = true) { } } export class SetLayerValuesLocation implements Action { diff --git a/projects/common-map/src/fm-map/effects/map.effects.ts b/projects/common-map/src/fm-map/effects/map.effects.ts index 474ecc1..b95221a 100644 --- a/projects/common-map/src/fm-map/effects/map.effects.ts +++ b/projects/common-map/src/fm-map/effects/map.effects.ts @@ -166,12 +166,14 @@ export class MapEffects { zoomToExtent2$ = createEffect(() => this.actions$.pipe( ofType(mapActions.SETFEATURES), switchMap((action: mapActions.SetFeatures) => { - const extent = createEmpty(); - if (extent) { - for (const f of action.features) { - extend(extent, (f as Feature).getGeometry().getExtent()); + if (action.zoomToExtent) { + const extent = createEmpty(); + if (extent) { + for (const f of action.features) { + extend(extent, (f as Feature).getGeometry().getExtent()); + } + if (action.features.length > 0) return of(new mapActions.SetExtent(extent)); } - if (action.features.length > 0) return of(new mapActions.SetExtent(extent)); } return EMPTY; })));