4th
This commit is contained in:
parent
ac0c00bb40
commit
e6acffb9ba
2 changed files with 62 additions and 13 deletions
|
|
@ -171,7 +171,7 @@
|
|||
inset: 0;
|
||||
background: rgba(0,0,0,0.0); /* invisibile ma cliccabile */
|
||||
display: none;
|
||||
z-index: 9998; /* appena sotto il bottom sheet */
|
||||
z-index: 80; /* appena sotto il bottom sheet */
|
||||
}
|
||||
|
||||
.sheet-overlay.open {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ console.log("main.js avviato");
|
|||
// Aspetta un tick così il layout è aggiornato
|
||||
setTimeout(() => {
|
||||
try {
|
||||
// Sostituisci con la tua variabile dell'istanza L.map, se diversa
|
||||
// In mapGlobal.js imposta: window.leafletMapInstance = window.globalMap;
|
||||
window.leafletMapInstance?.invalidateSize();
|
||||
} catch (e) {
|
||||
console.warn('invalidateSize non eseguito:', e);
|
||||
|
|
@ -64,6 +64,63 @@ console.log("main.js avviato");
|
|||
});
|
||||
})();
|
||||
|
||||
// ===============================
|
||||
// MENU ⋮ (toggle apri/chiudi con lo stesso bottone, senza global conflicts)
|
||||
// ===============================
|
||||
(() => {
|
||||
const optBtn = document.getElementById("optionsBtn");
|
||||
const optSheet = document.getElementById("optionsSheet");
|
||||
const overlayEl= document.getElementById("sheetOverlay");
|
||||
|
||||
if (!optBtn || !optSheet) return;
|
||||
|
||||
function openOptionsSheet() {
|
||||
try { window.closeBottomSheet?.(); } catch {}
|
||||
optSheet.classList.add("open");
|
||||
overlayEl?.classList.add("open");
|
||||
// ARIA (facoltativo)
|
||||
optBtn.setAttribute("aria-expanded", "true");
|
||||
optSheet.setAttribute("aria-hidden", "false");
|
||||
}
|
||||
|
||||
function closeOptionsSheet() {
|
||||
optSheet.classList.remove("open");
|
||||
overlayEl?.classList.remove("open");
|
||||
// ARIA (facoltativo)
|
||||
optBtn.setAttribute("aria-expanded", "false");
|
||||
optSheet.setAttribute("aria-hidden", "true");
|
||||
}
|
||||
|
||||
function toggleOptionsSheet(e) {
|
||||
e?.preventDefault();
|
||||
e?.stopPropagation();
|
||||
if (optSheet.classList.contains("open")) closeOptionsSheet();
|
||||
else openOptionsSheet();
|
||||
}
|
||||
|
||||
// Click sul bottone: toggle (fase di cattura per battere eventuali altri handler)
|
||||
optBtn.addEventListener("click", toggleOptionsSheet, { capture: true });
|
||||
|
||||
// Chiudi clic overlay
|
||||
overlayEl?.addEventListener("click", (e) => {
|
||||
e.stopPropagation();
|
||||
closeOptionsSheet();
|
||||
});
|
||||
|
||||
// Chiudi con ESC
|
||||
document.addEventListener("keydown", (e) => {
|
||||
if (e.key === "Escape" && optSheet.classList.contains("open")) {
|
||||
closeOptionsSheet();
|
||||
}
|
||||
});
|
||||
|
||||
// Evita chiusure involontarie per click interni
|
||||
optSheet.addEventListener("click", (e) => e.stopPropagation());
|
||||
|
||||
// Espone una close per usarla altrove (es. dopo la scelta)
|
||||
window.closeOptionsSheet = closeOptionsSheet;
|
||||
})();
|
||||
|
||||
// ===============================
|
||||
// LOGIN AUTOMATICO SU INDEX
|
||||
// ===============================
|
||||
|
|
@ -116,16 +173,6 @@ window.currentSort = currentSort;
|
|||
window.currentGroup = currentGroup;
|
||||
window.currentFilter = currentFilter;
|
||||
|
||||
// ===============================
|
||||
// MENU ⋮
|
||||
// ===============================
|
||||
const optionsBtn = document.getElementById("optionsBtn");
|
||||
const optionsSheetEl = document.getElementById("optionsSheet");
|
||||
|
||||
optionsBtn?.addEventListener("click", () => {
|
||||
optionsSheetEl?.classList.add("open");
|
||||
});
|
||||
|
||||
// ===============================
|
||||
// BOTTONI OPZIONI
|
||||
// ===============================
|
||||
|
|
@ -135,7 +182,9 @@ document.querySelectorAll("#optionsSheet .sheet-btn").forEach(btn => {
|
|||
if (btn.dataset.group) window.currentGroup = currentGroup = btn.dataset.group;
|
||||
if (btn.dataset.filter) window.currentFilter = currentFilter = btn.dataset.filter;
|
||||
|
||||
optionsSheetEl?.classList.remove("open");
|
||||
// Chiudi sheet e overlay dopo la scelta (usa l’API esposta sopra)
|
||||
window.closeOptionsSheet?.();
|
||||
|
||||
refreshGallery();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue