Offline-Karten Runde 2: adaptives Modell (Budget, Funkloch-Gedaechtnis, Korridor, Coverage)
Design Rene 2026-06-06: - Budget-Download: z14-Ringe um den Standort bis 5 MB gespeicherte Bytes (Stadt klein, Land gross — passend zur Funknetzdichte); client-seitig, Server-Region-Extract entfaellt - Funkloch-Gedaechtnis: Tile-Miss bei aktivem GPS-Recording -> Zone gemerkt (lokal, nie hochgeladen); Auto-Download offener Zonen sobald online - Routen-Korridor: 'Offline'-Button im Routen-Detail, Kacheln +-1km um den Track + Marker (Cap 50 MB) — fuer mehrtaegige Unternehmungen - Coverage-Layer: gespeicherte Bereiche als blauer Layer; Offline-Button oeffnet Verwaltungs-Modal (Stats, speichern, anzeigen, loeschen) - Flag-Logik zentral in boot.js BY.offlineTiles() (war 3x dupliziert) Bump v1226
This commit is contained in:
parent
45534aa8ee
commit
42a04ec405
12 changed files with 466 additions and 91 deletions
|
|
@ -2437,6 +2437,7 @@ window.Page_routes = (() => {
|
|||
${_actionBtn('rd-share', 'arrow-square-out', 'Teilen')}
|
||||
${_actionBtn('rd-navi', 'map-pin', 'Navi')}
|
||||
${_appState.user ? _actionBtn('rd-note', 'note-pencil', 'Notiz') : ''}
|
||||
${(window.BY?.offlineTiles?.() && track.length >= 2) ? _actionBtn('rd-offline', 'cloud-arrow-down', 'Offline') : ''}
|
||||
</div>
|
||||
${ownerRow}
|
||||
<button type="button" class="btn btn-primary w-full" id="rd-close">Schließen</button>
|
||||
|
|
@ -2460,6 +2461,31 @@ window.Page_routes = (() => {
|
|||
document.getElementById('rd-close')?.addEventListener('click', UI.modal.close);
|
||||
document.getElementById('rd-gpx')?.addEventListener('click', () => _downloadGpxDirect(route));
|
||||
|
||||
// Route offline speichern: Kachel-Korridor ±1 km um den Track + Marker → IndexedDB
|
||||
// (für mehrtägige Unternehmungen entlang der Route, docs/OFFLINE_MAPS_PLAN.md).
|
||||
document.getElementById('rd-offline')?.addEventListener('click', async () => {
|
||||
const btn = document.getElementById('rd-offline');
|
||||
if (!btn || btn.dataset.busy) return;
|
||||
btn.dataset.busy = '1';
|
||||
const label = btn.querySelector('span');
|
||||
try {
|
||||
await UI.loadMapLibreUI(); // lädt pmtiles + map-offline (byt://-Stack) bei Bedarf
|
||||
const res = await MapOffline.downloadCorridor(track, {
|
||||
bufferKm: 1, name: route.name,
|
||||
onProgress: p => { if (label) label.textContent = `${(p.bytes / 1048576).toFixed(1)} MB`; },
|
||||
});
|
||||
if (label) label.textContent = 'Offline ✓';
|
||||
UI.toast.success(`Route offline gespeichert — Korridor ±1 km, ${res.pois || 0} Marker, `
|
||||
+ `${(res.bytes / 1048576).toFixed(1)} MB.${res.capped ? ' (50-MB-Limit erreicht)' : ''}`);
|
||||
window.OfflineIndicator?.refresh();
|
||||
} catch (e) {
|
||||
if (label) label.textContent = 'Offline';
|
||||
UI.toast.error('Offline-Speichern fehlgeschlagen.');
|
||||
} finally {
|
||||
delete btn.dataset.busy;
|
||||
}
|
||||
});
|
||||
|
||||
// Teilen-Button
|
||||
document.getElementById('rd-share')?.addEventListener('click', async () => {
|
||||
const shareUrl = location.origin + '/#routes?id=' + route.id;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue