Skip to content

Commit 82bf9a3

Browse files
authored
Fix issue with modal image viewer with low live_preview_refresh_period (#16981)
1 parent ebbc56b commit 82bf9a3

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ module.exports = {
8888
// imageviewer.js
8989
modalPrevImage: "readonly",
9090
modalNextImage: "readonly",
91+
updateModalImageIfVisible: "readonly",
9192
// localStorage.js
9293
localSet: "readonly",
9394
localGet: "readonly",

javascript/imageviewer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ function updateOnBackgroundChange() {
5454
updateModalImage();
5555
}
5656
}
57+
const updateModalImageIfVisible = updateOnBackgroundChange;
5758

5859
function modalImageSwitch(offset) {
5960
var galleryButtons = all_gallery_buttons();
@@ -164,6 +165,7 @@ function modalLivePreviewToggle(event) {
164165
const modalToggleLivePreview = gradioApp().getElementById("modal_toggle_live_preview");
165166
opts.js_live_preview_in_modal_lightbox = !opts.js_live_preview_in_modal_lightbox;
166167
modalToggleLivePreview.innerHTML = opts.js_live_preview_in_modal_lightbox ? "🗇" : "🗆";
168+
updateModalImageIfVisible();
167169
event.stopPropagation();
168170
}
169171

javascript/progressbar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
190190
livePreview.className = 'livePreview';
191191
gallery.insertBefore(livePreview, gallery.firstElementChild);
192192
}
193-
193+
updateModalImageIfVisible();
194194
livePreview.appendChild(img);
195195
if (livePreview.childElementCount > 2) {
196196
livePreview.removeChild(livePreview.firstElementChild);

style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ table.popup-table .link{
602602
background: var(--background-fill-primary);
603603
width: 100%;
604604
height: 100%;
605+
pointer-events: none;
605606
}
606607

607608
.livePreview img{

0 commit comments

Comments
 (0)