Skip to content

Commit

Permalink
one more zoom out if faster for speeds above 23m/s
Browse files Browse the repository at this point in the history
  • Loading branch information
karussell committed Aug 13, 2023
1 parent 62cc97f commit b90f2aa
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/stores/MapActionReceiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,12 @@ export default class MapActionReceiver implements ActionReceiver {
// we only change to the lower zoom when below 14.4km/h and change to the higher speed when above 28.8km/h.
// And because the animation could be cancelled the oldZoom could be a none-integer value.
const oldZoom = mapView.getZoom()
if (!oldZoom || oldZoom < 17 || oldZoom > 18) args.zoom = 18
else if (oldZoom <= 18 && action.speed < 6) args.zoom = 18
else if (oldZoom >= 17 && action.speed > 8) args.zoom = 17
if (!oldZoom || oldZoom < 16) args.zoom = 16
else if (oldZoom > 18) args.zoom = 18
// actively change zoom for certain speeds only (at certain speeds no change)
else if (action.speed < 6) args.zoom = 18
else if (action.speed > 8 && action.speed <= 20) args.zoom = 17
else if (action.speed > 23) args.zoom = 16

// console.log('zoom ' + args.zoom + ', old ' + oldZoom + ', speed:' + action.speed)

Expand Down

0 comments on commit b90f2aa

Please sign in to comment.