From 835d3b46c15133c4c29dbe153c919c1939b0f197 Mon Sep 17 00:00:00 2001 From: Konstantinos Kamaropoulos Date: Sun, 1 Mar 2020 14:57:30 +0200 Subject: [PATCH] feat: Fly to the last point on load and whenever a new log arrives --- src/app/map/map.component.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app/map/map.component.ts b/src/app/map/map.component.ts index d8af532..fff3c12 100644 --- a/src/app/map/map.component.ts +++ b/src/app/map/map.component.ts @@ -24,6 +24,8 @@ export class MapComponent implements OnInit { sub: any; + lastPoint: number[]; + constructor(private logsService: LogsService) {} async ngOnInit() { @@ -69,7 +71,13 @@ export class MapComponent implements OnInit { .setPopup(popup) .addTo(this.map); } + this.lastPoint = [log['gps_data']['longitude'], log['gps_data']['latitude']]; } + this.map.flyTo({ + center: [this.lastPoint[0], this.lastPoint[1]], + essential: true, // this animation is considered essential with respect to prefers-reduced-motion + zoom: 22 + }); }); } }