From 805fa71dfb37664e2669c312a520b7cfb732d1c4 Mon Sep 17 00:00:00 2001 From: Kubuxu Date: Sat, 8 Jul 2023 22:19:44 +0100 Subject: [PATCH] Cleanup and make condition simpler --- javascript/imageViewer.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/javascript/imageViewer.js b/javascript/imageViewer.js index 7e1001225..5876678de 100644 --- a/javascript/imageViewer.js +++ b/javascript/imageViewer.js @@ -18,7 +18,6 @@ function showModal(event) { // show the save button in modal only on txt2img or img2img tabs if (tabTxt2Img.style.display != 'none' || tabImg2Img.style.display != 'none') gradioApp().getElementById('modal_save').style.display = 'inline'; else gradioApp().getElementById('modal_save').style.display = 'none'; - const ignoreEvent = (ev) => {ev.stopImmediatePropagation()} preventImmediateClose = true setTimeout(() => { @@ -201,7 +200,7 @@ document.addEventListener('DOMContentLoaded', () => { modalPreviewZone.addEventListener('mousedown', () => drag = false); modalPreviewZone.addEventListener('mousemove', () => drag = true); modalPreviewZone.addEventListener('scroll', () => drag = true); - modalPreviewZone.addEventListener('mouseup', () => { if (!drag && !preventImmediateClose) closeModal(); }); + modalPreviewZone.addEventListener('mouseup', () => { if (!(drag || preventImmediateClose)) closeModal(); }); const modalPrev = document.createElement('a'); modalPrev.className = 'modalPrev';