From 06249963c65b576dfef4bfe5a6f44606d48243d7 Mon Sep 17 00:00:00 2001 From: Eskimue Date: Wed, 29 Apr 2026 13:08:20 +0200 Subject: [PATCH] Mondphasenexport verbessert --- public/monatsvorhersage.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public/monatsvorhersage.php b/public/monatsvorhersage.php index fb47783..67b37ba 100644 --- a/public/monatsvorhersage.php +++ b/public/monatsvorhersage.php @@ -2973,7 +2973,10 @@ function getMonthChartExportLogo() { return monthChartExportLogoPromise; } -async function composeExportCanvas(sourceCanvas, logoPosition) { +async function composeExportCanvas(sourceCanvas, logoPosition, options) { + const exportOptions = options && typeof options === 'object' ? options : {}; + const showCaption = exportOptions.showCaption !== false; + const logoScale = Number.isFinite(Number(exportOptions.logoScale)) ? Number(exportOptions.logoScale) : 1; const exportCanvas = document.createElement('canvas'); exportCanvas.width = sourceCanvas.width; exportCanvas.height = sourceCanvas.height; @@ -2990,7 +2993,7 @@ async function composeExportCanvas(sourceCanvas, logoPosition) { const logo = await getMonthChartExportLogo(); if (logo) { const padding = Math.round(exportCanvas.width * 0.024); - const targetWidth = Math.max(180, Math.min(320, Math.round(exportCanvas.width * 0.14))); + const targetWidth = Math.max(90, Math.min(320, Math.round(exportCanvas.width * 0.14 * logoScale))); const targetHeight = Math.round(targetWidth * (logo.naturalHeight / Math.max(1, logo.naturalWidth))); const drawX = padding; const drawY = logoPosition === 'bottom-left' @@ -3000,7 +3003,7 @@ async function composeExportCanvas(sourceCanvas, logoPosition) { } const caption = monthChartExportCaption(); - if (caption !== '') { + if (showCaption && caption !== '') { const padding = Math.round(exportCanvas.width * 0.024); const fontSize = Math.max(26, Math.round(exportCanvas.width * 0.022)); exportCtx.save(); @@ -3509,7 +3512,7 @@ function monthChartCometRaDec(comet, date) { const exportWidth = MONTH_CHART_EXPORT_WIDTH; const exportHeight = Math.round(exportWidth * (220 / 1200)); renderPhaseCanvas(exportWidth, exportHeight, 1, false); - composeExportCanvas(canvas, 'bottom-left').then(function (exportCanvas) { + composeExportCanvas(canvas, 'bottom-left', { showCaption: false, logoScale: 0.6 }).then(function (exportCanvas) { triggerCanvasDownload(exportCanvas || canvas, monthPhaseExportFilename()); }); } finally {