diff options
author | DepFA <35278260+dfaker@users.noreply.github.com> | 2022-09-23 20:29:01 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2022-09-23 20:38:45 +0000 |
commit | e560eb8b60f01cb44fc84ab44d9719fcc92a1288 (patch) | |
tree | 0894192f4e6a4cca683d9c67a22a3a27d1441c49 /javascript | |
parent | e12793e9373d3b02cc385f6b215c4b131e0081be (diff) | |
download | stable-diffusion-webui-gfx803-e560eb8b60f01cb44fc84ab44d9719fcc92a1288.tar.gz stable-diffusion-webui-gfx803-e560eb8b60f01cb44fc84ab44d9719fcc92a1288.tar.bz2 stable-diffusion-webui-gfx803-e560eb8b60f01cb44fc84ab44d9719fcc92a1288.zip |
Only switch between visible gallery entries
Since the other tabs are kept in the dom now filtering is needed.
Diffstat (limited to 'javascript')
-rw-r--r-- | javascript/imageviewer.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/javascript/imageviewer.js b/javascript/imageviewer.js index 5300b499..3a0baac8 100644 --- a/javascript/imageviewer.js +++ b/javascript/imageviewer.js @@ -22,10 +22,22 @@ function negmod(n, m) { } function modalImageSwitch(offset){ - var galleryButtons = gradioApp().querySelectorAll(".gallery-item.transition-all") + var allgalleryButtons = gradioApp().querySelectorAll(".gallery-item.transition-all") + var galleryButtons = [] + allgalleryButtons.forEach(function(elem){ + if(elem.parentElement.offsetParent){ + galleryButtons.push(elem); + } + }) if(galleryButtons.length>1){ - var currentButton = gradioApp().querySelector(".gallery-item.transition-all.\\!ring-2") + var allcurrentButtons = gradioApp().querySelectorAll(".gallery-item.transition-all.\\!ring-2") + var currentButton = null + allcurrentButtons.forEach(function(elem){ + if(elem.parentElement.offsetParent){ + currentButton = elem; + } + }) var result = -1 galleryButtons.forEach(function(v, i){ if(v==currentButton) { result = i } }) |