From 9da1796774528723caa0f40318ade000e5780964 Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Thu, 23 Jul 2026 16:21:58 +0700 Subject: [PATCH] fix: cap map zoom out, prevent grey bands and tile duplication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- src/components/SpotMap.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/SpotMap.tsx b/src/components/SpotMap.tsx index 13d8027..c72bc86 100644 --- a/src/components/SpotMap.tsx +++ b/src/components/SpotMap.tsx @@ -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