fix: cap map zoom out, prevent grey bands and tile duplication
- minZoom: 2 — stops user zooming past a single world view - maxBounds: full lat range with infinite lng — locks vertical pan to the world - maxBoundsViscosity: 1.0 — hard clamp, no elastic bounce into grey space - TileLayer minZoom: 2 to match Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
This commit is contained in:
parent
e8151bee17
commit
9da1796774
1 changed files with 9 additions and 2 deletions
|
|
@ -662,11 +662,18 @@ export function SpotMap({
|
|||
center,
|
||||
zoom,
|
||||
scrollWheelZoom: true,
|
||||
attributionControl: false, // Remove attribution control
|
||||
attributionControl: false,
|
||||
// Prevent zooming out past a single world view (no grey space, no tile duplication)
|
||||
minZoom: 2,
|
||||
// Clamp panning so the world fills the viewport — no grey bands above/below
|
||||
maxBounds: [[-90, -Infinity], [90, Infinity]],
|
||||
maxBoundsViscosity: 1.0,
|
||||
});
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '', // Remove attribution text
|
||||
attribution: '',
|
||||
// Match minZoom so tiles are always available at the minimum zoom level
|
||||
minZoom: 2,
|
||||
}).addTo(map);
|
||||
|
||||
// Add click handler if enabled
|
||||
|
|
|
|||
Loading…
Reference in a new issue