fix: map zoom limits configurable per-deployment via data attributes
Pi offline tiles only cover zoom 8-15; OSM live tiles support 0-19. history.js now reads data-min-zoom/data-max-zoom from the #history-map div instead of hardcoding 3/19. Pi template caps to 8-15 (prevents blank tiles at extreme zooms), server template allows full 3-19 OSM range. Co-authored-by: Copilot <[email protected]>
This commit is contained in:
@@ -56,7 +56,8 @@
|
||||
<div class="card-body p-0">
|
||||
<div id="history-map" aria-label="Selected trip route map"
|
||||
data-tile-url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
data-tile-attrib="© <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors"></div>
|
||||
data-tile-attrib="© <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors"
|
||||
data-min-zoom="3" data-max-zoom="19"></div>
|
||||
<div id="trip-timeline" class="border-top p-3" hidden>
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<button id="trip-play" class="btn btn-primary btn-sm" type="button" aria-label="Play">
|
||||
|
||||
@@ -13,10 +13,12 @@
|
||||
const mapEl = document.getElementById("history-map");
|
||||
const tileUrl = mapEl.dataset.tileUrl || "/static/vendor/tiles/{z}/{x}/{y}.png";
|
||||
const tileAttrib = mapEl.dataset.tileAttrib || "© MapTiler © OpenStreetMap contributors";
|
||||
const map = L.map("history-map", { minZoom: 3, maxZoom: 19 }).setView([48.505, -0.09], 12);
|
||||
const minZoom = parseInt(mapEl.dataset.minZoom || "3", 10);
|
||||
const maxZoom = parseInt(mapEl.dataset.maxZoom || "19", 10);
|
||||
const map = L.map("history-map", { minZoom, maxZoom }).setView([48.505, -0.09], 12);
|
||||
const tiles = L.tileLayer(tileUrl, {
|
||||
minZoom: 3,
|
||||
maxZoom: 19,
|
||||
minZoom,
|
||||
maxZoom,
|
||||
attribution: tileAttrib,
|
||||
});
|
||||
let routeLayer = null;
|
||||
|
||||
@@ -54,7 +54,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div id="history-map" aria-label="Selected trip route map"></div>
|
||||
<div id="history-map" aria-label="Selected trip route map"
|
||||
data-min-zoom="8" data-max-zoom="15"></div>
|
||||
<div id="trip-timeline" class="border-top p-3" hidden>
|
||||
<div class="d-flex align-items-center gap-3">
|
||||
<button id="trip-play" class="btn btn-primary btn-sm" type="button" aria-label="Play">
|
||||
|
||||
Reference in New Issue
Block a user