Fix: Karte-Höhe via JS, events Leaflet-Pfad, Hamburger-Menü mobile Drawer
This commit is contained in:
parent
0438bd6bfe
commit
d4c3f159d5
6 changed files with 107 additions and 3 deletions
|
|
@ -83,9 +83,55 @@
|
|||
}
|
||||
.header-back:hover { background: var(--c-surface-2); }
|
||||
|
||||
/* Hamburger-Button (nur Mobile) */
|
||||
.header-menu-btn {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
background: transparent;
|
||||
font-size: 1.3rem;
|
||||
color: var(--c-text);
|
||||
cursor: pointer;
|
||||
border-radius: var(--radius-md);
|
||||
flex-shrink: 0;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
.header-menu-btn:hover { background: var(--c-surface-2); }
|
||||
|
||||
/* Backdrop für mobile Sidebar */
|
||||
.sidebar-backdrop {
|
||||
display: none;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.45);
|
||||
z-index: 499;
|
||||
}
|
||||
.sidebar-backdrop.visible { display: block; }
|
||||
|
||||
/* Auf Desktop keinen mobilen Header zeigen */
|
||||
@media (min-width: 768px) {
|
||||
#app-header { display: none; }
|
||||
.header-menu-btn { display: none; }
|
||||
.sidebar-backdrop { display: none !important; }
|
||||
}
|
||||
|
||||
/* Mobile Sidebar als Drawer */
|
||||
@media (max-width: 767px) {
|
||||
#sidebar {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
left: calc(-1 * var(--nav-sidebar-width));
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 500;
|
||||
transition: left 0.28s ease;
|
||||
}
|
||||
#sidebar.open {
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -39,8 +39,12 @@
|
|||
<span class="header-title" id="header-title">Ban Yaro</span>
|
||||
</div>
|
||||
<div id="header-actions"></div>
|
||||
<button class="header-menu-btn" id="header-menu-btn" aria-label="Menü">☰</button>
|
||||
</header>
|
||||
|
||||
<!-- Backdrop für mobile Sidebar-Drawer -->
|
||||
<div id="sidebar-backdrop" class="sidebar-backdrop"></div>
|
||||
|
||||
<!-- DESKTOP SIDEBAR -->
|
||||
<nav id="sidebar" role="navigation" aria-label="Hauptnavigation">
|
||||
<div class="sidebar-logo" id="sidebar-dog-switcher">
|
||||
|
|
|
|||
|
|
@ -150,11 +150,30 @@ const App = (() => {
|
|||
// + Button (Mobile Bottom-Nav + Desktop Sidebar)
|
||||
if (e.target.closest('#nav-add') || e.target.closest('#sidebar-add')) {
|
||||
_showQuickAdd();
|
||||
return;
|
||||
}
|
||||
|
||||
// Hamburger-Menü (Mobile)
|
||||
if (e.target.closest('#header-menu-btn')) {
|
||||
_toggleSidebar();
|
||||
return;
|
||||
}
|
||||
|
||||
// Backdrop → Sidebar schließen
|
||||
if (e.target.closest('#sidebar-backdrop')) {
|
||||
_closeSidebar();
|
||||
return;
|
||||
}
|
||||
|
||||
// Sidebar-Item auf Mobile → schließen nach Navigation
|
||||
if (e.target.closest('#sidebar .sidebar-item')) {
|
||||
_closeSidebar();
|
||||
}
|
||||
});
|
||||
|
||||
// Browser Back/Forward
|
||||
window.addEventListener('popstate', e => {
|
||||
_closeSidebar();
|
||||
const page = e.state?.page || 'diary';
|
||||
navigate(page, false);
|
||||
});
|
||||
|
|
@ -163,6 +182,26 @@ const App = (() => {
|
|||
// damit kein doppelter _loadPage()-Aufruf entsteht.
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// MOBILE SIDEBAR DRAWER
|
||||
// ----------------------------------------------------------
|
||||
function _toggleSidebar() {
|
||||
const sidebar = document.getElementById('sidebar');
|
||||
const backdrop = document.getElementById('sidebar-backdrop');
|
||||
const isOpen = sidebar?.classList.contains('open');
|
||||
isOpen ? _closeSidebar() : _openSidebar();
|
||||
}
|
||||
|
||||
function _openSidebar() {
|
||||
document.getElementById('sidebar')?.classList.add('open');
|
||||
document.getElementById('sidebar-backdrop')?.classList.add('visible');
|
||||
}
|
||||
|
||||
function _closeSidebar() {
|
||||
document.getElementById('sidebar')?.classList.remove('open');
|
||||
document.getElementById('sidebar-backdrop')?.classList.remove('visible');
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// SCHNELL-HINZUFÜGEN (+ Button)
|
||||
// ----------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -201,10 +201,10 @@ window.Page_events = (() => {
|
|||
return new Promise((resolve, reject) => {
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = '/js/lib/leaflet.css';
|
||||
link.href = '/css/leaflet.css';
|
||||
document.head.appendChild(link);
|
||||
const s = document.createElement('script');
|
||||
s.src = '/js/lib/leaflet.js';
|
||||
s.src = '/js/leaflet.js';
|
||||
s.onload = resolve;
|
||||
s.onerror = reject;
|
||||
document.head.appendChild(s);
|
||||
|
|
|
|||
|
|
@ -129,6 +129,19 @@ window.Page_map = (() => {
|
|||
const el = document.getElementById('central-map');
|
||||
if (!el || !window.L || _map) return;
|
||||
|
||||
// Explizite Pixel-Höhe setzen, damit Leaflet Kacheln lädt.
|
||||
// height:100% auf einem flex:1-Child ohne feste Parent-Höhe = 0px.
|
||||
const layout = el.closest('.map-full-layout');
|
||||
if (layout) {
|
||||
const top = layout.getBoundingClientRect().top;
|
||||
layout.style.height = (window.innerHeight - top) + 'px';
|
||||
window.addEventListener('resize', () => {
|
||||
const t = layout.getBoundingClientRect().top;
|
||||
layout.style.height = (window.innerHeight - t) + 'px';
|
||||
_map?.invalidateSize();
|
||||
});
|
||||
}
|
||||
|
||||
const center = _userPos ? [_userPos.lat, _userPos.lon] : [51.1657, 10.4515];
|
||||
const zoom = _userPos ? 13 : 6;
|
||||
|
||||
|
|
@ -137,6 +150,8 @@ window.Page_map = (() => {
|
|||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 19 })
|
||||
.addTo(_map);
|
||||
|
||||
setTimeout(() => _map.invalidateSize(), 100);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
Offline-Cache + Push Notifications
|
||||
============================================================ */
|
||||
|
||||
const CACHE_VERSION = 'by-v24';
|
||||
const CACHE_VERSION = 'by-v25';
|
||||
const CACHE_STATIC = `${CACHE_VERSION}-static`;
|
||||
|
||||
// Diese Dateien werden beim Install gecacht (App Shell)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue