Add CSS-based fullscreen for Map tab; fix state desync bug
- Add fullscreen toggle button (⛶/✕) to Map tab controls row - CSS class `map-fs` hides header/nav and expands map to fill screen - Drop unreliable requestFullscreen() API (blocked on iOS/PWA) in favor of pure CSS approach - Fix button state desync: syncBtn() runs on init so stale ✕ state can't persist across reloads - Shrink embedded radar height on mobile (220px) and tune dvh calculations for safe-area insets Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
48ae797520
commit
b9e6cad190
3 files changed
+106
-36
No files matched your search
@@ -1089,6 +1089,37 @@ const radarFull = radarFullEl
|
||||
)
|
||||
: { map: null, panTo: () => {}, startPlay: () => {}, stopPlay: () => {}, refresh: () => {} };
|
||||
|
||||
(function initMapFullscreen() {
|
||||
const fsBtn = document.getElementById('map-fullscreen-btn');
|
||||
if (!fsBtn) return;
|
||||
|
||||
function isFs() { return document.body.classList.contains('map-fs'); }
|
||||
|
||||
function syncBtn() {
|
||||
if (isFs()) { fsBtn.textContent = '✕'; fsBtn.title = 'Exit fullscreen'; }
|
||||
else { fsBtn.textContent = '⛶'; fsBtn.title = 'Fullscreen'; }
|
||||
}
|
||||
|
||||
function enterFs() {
|
||||
document.body.classList.add('map-fs');
|
||||
syncBtn();
|
||||
setTimeout(() => { unifiedMap && unifiedMap.refresh && unifiedMap.refresh(); }, 120);
|
||||
}
|
||||
|
||||
function exitFs() {
|
||||
document.body.classList.remove('map-fs');
|
||||
syncBtn();
|
||||
setTimeout(() => { unifiedMap && unifiedMap.refresh && unifiedMap.refresh(); }, 120);
|
||||
}
|
||||
|
||||
// Sync on load in case of stale state
|
||||
syncBtn();
|
||||
|
||||
fsBtn.addEventListener('click', () => {
|
||||
if (isFs()) exitFs(); else enterFs();
|
||||
});
|
||||
})();
|
||||
|
||||
function createOverviewMap(mapEl) {
|
||||
const map = new maplibregl.Map({
|
||||
container: mapEl,
|
||||
|
||||
Reference in new issue
Block a user