address PR feedback

This commit is contained in:
Ryan Meador
2026-01-19 21:04:04 -05:00
parent a38e5af3b3
commit 300bc31de7
3 changed files with 31 additions and 35 deletions
+5 -5
View File
@@ -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})`);
}