From 57e4a0a9d7527deb741778a1dbffca28cc6ffc5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= Date: Mon, 31 May 2021 17:09:29 -0400 Subject: [PATCH] fix(directions): auto zoom on new stop/route --- .../directions-form-binding.directive.ts | 10 +++++++--- .../directions-form/directions-form.component.ts | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/geo/src/lib/directions/directions-form/directions-form-binding.directive.ts b/packages/geo/src/lib/directions/directions-form/directions-form-binding.directive.ts index 2e40e0c2aa..64416ac04e 100644 --- a/packages/geo/src/lib/directions/directions-form/directions-form-binding.directive.ts +++ b/packages/geo/src/lib/directions/directions-form/directions-form-binding.directive.ts @@ -7,6 +7,7 @@ import { } from '@angular/core'; import { RouteService } from '@igo2/core'; +import { delay } from 'rxjs/operators'; import { Directions } from '../shared/directions.interface'; import { DirectionsService } from '../shared/directions.service'; @@ -57,9 +58,11 @@ export class DirectionsFormBindingDirective implements AfterViewInit { this.component.addStopOverlay(stopCoordinatesFromURL, cnt); cnt++; }); - this.component.activeRoute$.subscribe((activeRoute) => { - this.getRoutes(activeRoute); - }); + this.component.activeRoute$ + .pipe(delay(250)) + .subscribe((activeRoute) => { + this.getRoutes(activeRoute); + }); } } }); @@ -93,6 +96,7 @@ export class DirectionsFormBindingDirective implements AfterViewInit { this.component.routesResults = route; if (!activeRoute) { this.component.activeRoute = route[0] as Directions; + this.component.showRouteGeometry(true); return; } this.component.showRouteGeometry(true); diff --git a/packages/geo/src/lib/directions/directions-form/directions-form.component.ts b/packages/geo/src/lib/directions/directions-form/directions-form.component.ts index 59b10f9326..e4cfc7031d 100644 --- a/packages/geo/src/lib/directions/directions-form/directions-form.component.ts +++ b/packages/geo/src/lib/directions/directions-form/directions-form.component.ts @@ -1015,7 +1015,7 @@ export class DirectionsFormComponent implements OnInit, OnDestroy { } getRoutes( - moveToExtent: boolean = true, + moveToExtent: boolean = false, directionsOptions: DirectionsOptions = {} ) { this.deleteStoreFeatureByID(this.routeStore, 'vertex');