aboutsummaryrefslogtreecommitdiffstats
path: root/script.js
diff options
context:
space:
mode:
authorConnum <connum@gmail.com>2022-09-26 16:12:55 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2022-09-27 05:59:40 +0000
commitc0b1177a3203091ca43f2d08f24dd821f1237612 (patch)
treeaf49868aae794db016a7a6a514b709645a6467a6 /script.js
parent8dcac9ac81db587cdac59d01db85c01579156392 (diff)
downloadstable-diffusion-webui-gfx803-c0b1177a3203091ca43f2d08f24dd821f1237612.tar.gz
stable-diffusion-webui-gfx803-c0b1177a3203091ca43f2d08f24dd821f1237612.tar.bz2
stable-diffusion-webui-gfx803-c0b1177a3203091ca43f2d08f24dd821f1237612.zip
refactored image paste handling to fill unset images successively, then replace last existing image (fixes #981)
Diffstat (limited to 'script.js')
-rw-r--r--script.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/script.js b/script.js
index 7f26e23b..cf989605 100644
--- a/script.js
+++ b/script.js
@@ -39,3 +39,24 @@ document.addEventListener("DOMContentLoaded", function() {
});
mutationObserver.observe( gradioApp(), { childList:true, subtree:true })
});
+
+/**
+ * checks that a UI element is not in another hidden element or tab content
+ */
+function uiElementIsVisible(el) {
+ let isVisible = !el.closest('.\\!hidden');
+ if ( ! isVisible ) {
+ return false;
+ }
+
+ while( isVisible = el.closest('.tabitem')?.style.display !== 'none' ) {
+ if ( ! isVisible ) {
+ return false;
+ } else if ( el.parentElement ) {
+ el = el.parentElement
+ } else {
+ break;
+ }
+ }
+ return isVisible;
+} \ No newline at end of file