From db769dd995277b77da1ccf1d3ee126722996871a Mon Sep 17 00:00:00 2001 From: JeLuF Date: Thu, 16 Mar 2023 00:08:24 +0100 Subject: [PATCH 1/2] When zooming, only show one copy of the image Don't add a copy of the image for each live preview image shown --- ui/media/js/main.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/media/js/main.js b/ui/media/js/main.js index 57789cef..82d83799 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -322,15 +322,15 @@ function showImages(reqBody, res, outputContainer, livePreview) { imageModal(this.src) }) - const imageExpandBtn = imageItemElem.querySelector('.imgExpandBtn') - imageExpandBtn.addEventListener('click', function() { - imageModal(imageElem.src) - }) - const imageInfo = imageItemElem.querySelector('.imgItemInfo') imageInfo.style.visibility = (livePreview ? 'hidden' : 'visible') if ('seed' in result && !imageElem.hasAttribute('data-seed')) { + const imageExpandBtn = imageItemElem.querySelector('.imgExpandBtn') + imageExpandBtn.addEventListener('click', function() { + imageModal(imageElem.src) + }) + const req = Object.assign({}, reqBody, { seed: result?.seed || reqBody.seed }) From aa3bc864eeb75d0f81fdf2905ceed00fb01bb298 Mon Sep 17 00:00:00 2001 From: JeLuF Date: Thu, 16 Mar 2023 00:32:10 +0100 Subject: [PATCH 2/2] Also fix clicks into the image --- ui/media/js/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/media/js/main.js b/ui/media/js/main.js index 82d83799..53c3746b 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -318,9 +318,6 @@ function showImages(reqBody, res, outputContainer, livePreview) { imageElem.addEventListener('load', function() { imageItemElem.querySelector('.img_bottom_label').innerText = `${this.naturalWidth} x ${this.naturalHeight}` }) - imageElem.addEventListener('click', function() { - imageModal(this.src) - }) const imageInfo = imageItemElem.querySelector('.imgItemInfo') imageInfo.style.visibility = (livePreview ? 'hidden' : 'visible') @@ -330,6 +327,9 @@ function showImages(reqBody, res, outputContainer, livePreview) { imageExpandBtn.addEventListener('click', function() { imageModal(imageElem.src) }) + imageElem.addEventListener('click', function() { + imageModal(this.src) + }) const req = Object.assign({}, reqBody, { seed: result?.seed || reqBody.seed