Skip to content

Commit

Permalink
Only pan down after the warp if the boundary is still off screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Castle committed Jun 6, 2024
1 parent 71f7533 commit 711875d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions plugins/explore.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,12 @@ window.plugin.explore.State = class {
const dest = new L.LatLng(window.map.getBounds().getSouth(),
this.data.boundary.getWest());
this.#moveTo(dest);
const mapSize = window.map.getSize();
const offset = new L.Point(0, mapSize.y * 45 / 100);
window.map.panBy(offset, {animate: false});
// If there is room, do a pan as well.
if (test.lat < window.map.getBounds().getSouth()) {
const mapSize = window.map.getSize();
const offset = new L.Point(0, mapSize.y * 45 / 100);
window.map.panBy(offset, {animate: false});
}
this.status = 'Moved southwest';
}
}
Expand Down

0 comments on commit 711875d

Please sign in to comment.