Browse Source

feat: Only fly to latest marker if there was a new one

master
Konstantinos Kamaropoulos 5 years ago
parent
commit
33c4d5424b
  1. 14
      src/app/map/map.component.ts

14
src/app/map/map.component.ts

@ -50,8 +50,10 @@ export class MapComponent implements OnInit {
} else {
data = await this.logsService.getUpdates();
}
let newPointsCount = 0;
for (let log of data) {
if (log['gps_data']['status'] == 'A') {
newPointsCount++;
let html =
log['gps_data']['datestamp'] +
' ' +
@ -73,11 +75,13 @@ export class MapComponent implements OnInit {
}
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
});
if (newPointsCount) {
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
});
}
});
}
}

Loading…
Cancel
Save