image viewer refocus on close

Signed-off-by: Vladimir Mandic <mandic00@live.com>
pull/4252/head
Vladimir Mandic 2025-10-06 17:59:38 -04:00
parent 18f6ebb3f1
commit d012ad5556
3 changed files with 11 additions and 1 deletions

View File

@ -120,6 +120,7 @@
- reference: fix download for sd15/sdxl reference models
- fix checks in init/mask image decode
- fix hf token with extra chars
- image viewer refocus on gallery after returning from full screen mode
## Update for 2025-09-15

@ -1 +1 @@
Subproject commit 85ab79ed0f8a9c8484e2b2372d745527ebc84e7d
Subproject commit 39277a4688473e1e5fdb8a6173c8ded28c0439e1

View File

@ -15,11 +15,20 @@ function cycleImageFit() {
log('cycleImageFit', current, next);
}
function isInViewport(element) {
const rect = element.getBoundingClientRect();
return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
}
function closeModal(evt, force = false) {
if (force) gradioApp().getElementById('lightboxModal').style.display = 'none';
if (previewDrag) return;
if (evt?.button !== 0) return;
gradioApp().getElementById('lightboxModal').style.display = 'none';
let thumbnails = Array.from(gradioApp().querySelectorAll('.thumbnails .thumbnail-item'));
thumbnails = thumbnails.filter((el) => el.checkVisibility());
if (thumbnails.length === 0) return;
thumbnails[0].focus();
}
function modalImageSwitch(offset) {