From 382e181fc668027c7e1472a5d68046f9ffe62dde Mon Sep 17 00:00:00 2001 From: Sterling Archer Date: Tue, 9 Jun 2026 15:04:06 -0700 Subject: [PATCH] fix: any image dropped or uploaded while card is showing always swaps background without clearing fields --- index.html | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 0862b2e..d4690b8 100644 --- a/index.html +++ b/index.html @@ -1098,22 +1098,26 @@ function processStandard(file) { reader.onload = e => { const img = new Image(); img.onload = () => { + const cardIsShowing = outputSection.style.display && outputSection.style.display !== 'none'; + if (cardIsShowing) { + currentImg = img; + clearStatus(); + renderCard(img, readEditFields()); + return; + } EXIF.getData(img, function() { const exif = EXIF.getAllTags(this); const meta = extractMeta(exif); const hasExif = !!(meta.camera || meta.aperture || meta.shutter || meta.iso || meta.focalLength); - if (!hasExif) { - currentImg = img; - clearStatus(); - if (editPanel.style.display === 'none') populateEditFields({}, false); - const existingMeta = readEditFields(); - renderCard(img, existingMeta); - return; - } currentImg = img; clearStatus(); - populateEditFields(meta, false); - renderCard(img, meta); + if (hasExif) { + populateEditFields(meta, false); + renderCard(img, meta); + } else { + if (editPanel.style.display === 'none') populateEditFields({}, false); + renderCard(img, readEditFields()); + } }); }; img.onerror = () => showError('Could not decode this image. Try saving it as a JPEG or PNG first.');