Fix modal live preview not updating

Due to the behavior of scheduleAfterUiUpdateCallbacks if opts.live_preview_refresh_period < 200ms live preview in Modal image viewer may not update
Assing updateModalImageIfVisible as alias for updateOnBackgroundChange as the origin name is too generic
This commit is contained in:
w-e-w 2025-04-16 15:35:18 +09:00
parent 017ced6faa
commit 42075971ce
No known key found for this signature in database
GPG Key ID: 52CFE43196F6280E
3 changed files with 3 additions and 1 deletions

View File

@ -88,6 +88,7 @@ module.exports = {
// imageviewer.js // imageviewer.js
modalPrevImage: "readonly", modalPrevImage: "readonly",
modalNextImage: "readonly", modalNextImage: "readonly",
updateModalImageIfVisible: "readonly",
// localStorage.js // localStorage.js
localSet: "readonly", localSet: "readonly",
localGet: "readonly", localGet: "readonly",

View File

@ -54,6 +54,7 @@ function updateOnBackgroundChange() {
updateModalImage(); updateModalImage();
} }
} }
const updateModalImageIfVisible = updateOnBackgroundChange;
function modalImageSwitch(offset) { function modalImageSwitch(offset) {
var galleryButtons = all_gallery_buttons(); var galleryButtons = all_gallery_buttons();

View File

@ -190,7 +190,7 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
livePreview.className = 'livePreview'; livePreview.className = 'livePreview';
gallery.insertBefore(livePreview, gallery.firstElementChild); gallery.insertBefore(livePreview, gallery.firstElementChild);
} }
updateModalImageIfVisible();
livePreview.appendChild(img); livePreview.appendChild(img);
if (livePreview.childElementCount > 2) { if (livePreview.childElementCount > 2) {
livePreview.removeChild(livePreview.firstElementChild); livePreview.removeChild(livePreview.firstElementChild);