diff --git a/app.js b/app.js index fbed516..176cbc8 100644 --- a/app.js +++ b/app.js @@ -2972,14 +2972,18 @@ async function resolveLayerConfig(isLocalFile, statusEl) { exportOverlay.style.boxShadow = '0 0 10px rgba(0,0,0,0.3)'; const projName = document.getElementById('projectSelector')?.options[document.getElementById('projectSelector')?.selectedIndex]?.text || ''; - const projHtml = projName ? `
Projekt: ${projName}
` : `
`; + const projHtml = projName ? `
Projekt: ${projName}
` : `
`; + const dateHtml = `
Erstellt am: ${new Date().toLocaleDateString('de-DE')}
`; const showAux = document.getElementById('checkShowAux')?.checked; const showProx = document.getElementById('checkShowProximity')?.checked; exportOverlay.innerHTML = ` -
ENWELO Standortplanung
+
+ +
${projHtml} + ${dateHtml}
Rotorüberstreichfläche
${showAux ? `
Gebietsumring
` : ''} @@ -2989,19 +2993,41 @@ async function resolveLayerConfig(isLocalFile, statusEl) { `; mapContainer.appendChild(exportOverlay); - // Temporarily increase scale bar size - const scaleControl = document.querySelector('.leaflet-control-scale-line'); - let oldScaleStyle = ''; - if (scaleControl) { - oldScaleStyle = scaleControl.style.cssText; - scaleControl.style.transform = 'scale(1.5)'; - scaleControl.style.transformOrigin = 'bottom left'; - scaleControl.style.borderWidth = '2px'; - scaleControl.style.fontSize = '14px'; - } + // Add North Arrow + const northArrow = document.createElement('div'); + northArrow.style.position = 'absolute'; + northArrow.style.top = '30px'; + northArrow.style.right = '30px'; + northArrow.style.zIndex = '9999'; + northArrow.innerHTML = ` + + + + N + + `; + mapContainer.appendChild(northArrow); + + // Style the scale bar professionally + const scaleStyle = document.createElement('style'); + scaleStyle.innerHTML = ` + .leaflet-control-scale-line { + border: 2px solid #333 !important; + border-top: none !important; + background: rgba(255, 255, 255, 0.9) !important; + color: #111 !important; + font-weight: bold !important; + font-size: 14px !important; + padding: 4px 8px !important; + box-shadow: 0 0 10px rgba(0,0,0,0.4) !important; + transform: scale(1.5) !important; + transform-origin: bottom left !important; + } + `; + document.head.appendChild(scaleStyle); // Wait a tiny bit for DOM to render overlay - await new Promise(r => setTimeout(r, 100)); + await new Promise(r => setTimeout(r, 200)); const canvas = await html2canvas(mapContainer, { useCORS: true, @@ -3012,11 +3038,10 @@ async function resolveLayerConfig(isLocalFile, statusEl) { } }); - // Restore scale bar - if (scaleControl) { - scaleControl.style.cssText = oldScaleStyle; - } + // Cleanup + document.head.removeChild(scaleStyle); mapContainer.removeChild(exportOverlay); + mapContainer.removeChild(northArrow); const imgData = canvas.toDataURL('image/jpeg', 0.9); const pdf = new jspdf.jsPDF({