Skip to content

Commit

Permalink
Location: don't zoom in too close when activating. Fixes #1031.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobwod committed Jun 28, 2022
1 parent 572c122 commit 2c2c932
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion new-client/src/plugins/Location/LocationModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ class LocationModel {
this.localObserver.publish("locationStatus", "on");

if (this.zoomToLocation) {
this.map.getView().animate({ center: coordinates, zoom: 10 });
const maxZoom = this.map.getView().getMaxZoom();
const minZoom = this.map.getView().getMinZoom();
const zoom = Math.ceil((maxZoom - minZoom) * 0.5); // Let's end up in the middle zoom
this.map.getView().animate({ duration: 2500, center: coordinates, zoom });
this.zoomToLocation = false;
}
};
Expand Down

0 comments on commit 2c2c932

Please sign in to comment.