diff --git a/app/static/index.html b/app/static/index.html
index 42e7fcc..21f2088 100644
--- a/app/static/index.html
+++ b/app/static/index.html
@@ -941,23 +941,23 @@ function mapResetView() { if (map) map.setView([25, 10], 2); }
function currentBBox() {
const b = map.getBounds();
- // Leaflet at low zoom / worldCopyJump reports longitudes outside ±180
- // (and west>east after clamping). That made /api/cameras return a tiny
- // sliver (~dozens of pins) instead of the full set.
let west = b.getWest();
let east = b.getEast();
- let south = b.getSouth();
- let north = b.getNorth();
+ let south = Math.max(-90, Math.min(90, b.getSouth()));
+ let north = Math.max(-90, Math.min(90, b.getNorth()));
const lonSpan = east - west;
+ // World view, or a wrap that spans ~the whole globe.
if (map.getZoom() <= 3 || lonSpan >= 300) {
return '-180.0000,-85.0000,180.0000,85.0000';
}
- west = Math.max(-180, Math.min(180, west));
- east = Math.max(-180, Math.min(180, east));
- south = Math.max(-90, Math.min(90, south));
- north = Math.max(-90, Math.min(90, north));
+ // Normalize each edge into [-180, 180] WITHOUT clamping both to 180
+ // (that collapsed CA-on-a-wrapped-copy to an empty sliver).
+ const norm = (x) => ((x + 180) % 360 + 360) % 360 - 180;
+ west = norm(west);
+ east = norm(east);
if (west >= east) {
- return '-180.0000,-85.0000,180.0000,85.0000';
+ // Crosses the dateline: keep the latitude strip, don't drop the state.
+ return `-180.0000,${south.toFixed(4)},180.0000,${north.toFixed(4)}`;
}
return `${west.toFixed(4)},${south.toFixed(4)},${east.toFixed(4)},${north.toFixed(4)}`;
}
@@ -1114,7 +1114,7 @@ function camThumb(c) {
async function loadCams() {
if (!map) return;
try {
- const r = await fetch(`${API}/api/cameras?bbox=${currentBBox()}&limit=2000`);
+ const r = await fetch(`${API}/api/cameras?bbox=${currentBBox()}&limit=5000`);
const cams = await r.json();
if (camsGroup) map.removeLayer(camsGroup);
camsGroup = L.layerGroup(cams.map(c => {