// =============================== // PANNELLO INFO + MAPPA // =============================== const infoPanel = document.getElementById('infoPanel'); const infoBtn = document.getElementById('modalInfoBtn'); infoBtn.addEventListener('click', () => { if (!currentPhoto) return; const gps = currentPhoto.gps || { lat: '-', lng: '-', alt: '-' }; const folder = currentPhoto.path.split('/').slice(2, -1).join('/'); infoPanel.innerHTML = `

Informazioni

Nome: ${currentPhoto.name}
Data: ${currentPhoto.taken_at}
Latitudine: ${gps.lat}
Longitudine: ${gps.lng}
Altitudine: ${gps.alt} m
Dimensioni: ${currentPhoto.width} × ${currentPhoto.height}
Peso: ${(currentPhoto.size_bytes / 1024 / 1024).toFixed(2)} MB
Tipo: ${currentPhoto.mime_type}
Cartella: ${folder}
${gps.lat !== '-' ? '
' : ''} `; infoPanel.classList.add('open'); if (gps.lat !== '-' && gps.lng !== '-') { setTimeout(() => { const map = L.map('infoMap', { zoomControl: false, attributionControl: false }).setView([gps.lat, gps.lng], 13); L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 19 }).addTo(map); L.marker([gps.lat, gps.lng]).addTo(map); }, 50); } }); document.addEventListener('click', (e) => { if (!infoPanel.classList.contains('open')) return; const inside = infoPanel.contains(e.target); const btn = infoBtn.contains(e.target); if (!inside && !btn) infoPanel.classList.remove('open'); });