mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
address PR feedback
This commit is contained in:
@@ -53,15 +53,15 @@ function modalImageSwitch(offset) {
|
||||
|
||||
const galleryFilesContainer = gradioApp().getElementById('tab-gallery-files');
|
||||
if (!galleryFilesContainer || !galleryFilesContainer.offsetParent) return;
|
||||
const gallerySelection = window.getGallerySelection?.();
|
||||
if (!gallerySelection?.files?.length || gallerySelection.files.length <= 1) return;
|
||||
const gallerySelection = window.getGallerySelection();
|
||||
if (!gallerySelection.files.length || gallerySelection.files.length <= 1) return;
|
||||
const baseIndex = gallerySelection.index >= 0 ? gallerySelection.index : 0;
|
||||
const nextIndex = negmod((baseIndex + offset), gallerySelection.files.length);
|
||||
window.setGallerySelection?.(nextIndex, { send: true, emit: true });
|
||||
window.setGallerySelection(nextIndex, { send: true });
|
||||
const modalImage = gradioApp().getElementById('modalImage');
|
||||
const modal = gradioApp().getElementById('lightboxModal');
|
||||
const directSrc = window.getGallerySelectedUrl?.() || new URL(`/file=${encodeURI(window.currentImage)}`, window.location.origin).toString();
|
||||
if (modalImage && modal) {
|
||||
const directSrc = window.getGallerySelectedUrl();
|
||||
if (modalImage && modal && directSrc) {
|
||||
modalImage.src = directSrc;
|
||||
if (modalImage.style.display === 'none') modal.style.setProperty('background-image', `url(${directSrc})`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user