diff options
author | Thottyottyotty <thot@thiic.cc> | 2023-05-19 06:43:01 +0000 |
---|---|---|
committer | Thottyottyotty <thot@thiic.cc> | 2023-05-19 06:43:01 +0000 |
commit | 7b61acbd35e9db43a5279a42afad3f3dc68462c9 (patch) | |
tree | 0079a926476d8556f27eddd2e02c3005314b61f7 /script.js | |
parent | e373fd0c009beed4cd78af78583bf71b425b118e (diff) | |
download | stable-diffusion-webui-gfx803-7b61acbd35e9db43a5279a42afad3f3dc68462c9.tar.gz stable-diffusion-webui-gfx803-7b61acbd35e9db43a5279a42afad3f3dc68462c9.tar.bz2 stable-diffusion-webui-gfx803-7b61acbd35e9db43a5279a42afad3f3dc68462c9.zip |
split visibility method and sort instead
split out the visibility method for pasting and use a sort inside the paste handler to prioritize on-screen fields rather than targeting ONLY on screen fields
Diffstat (limited to 'script.js')
-rw-r--r-- | script.js | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -99,10 +99,14 @@ function uiElementIsVisible(el) { const computedStyle = getComputedStyle(el); const isVisible = computedStyle.display !== 'none'; + if (!isVisible) return false; + return uiElementIsVisible(el.parentNode); +} + +function uiElementInSight(el) { const clRect = el.getBoundingClientRect(); const windowHeight = window.innerHeight; - const onScreen = clRect.bottom > 0 && clRect.top < windowHeight; + const isOnScreen = clRect.bottom > 0 && clRect.top < windowHeight; - if (!isVisible || !onScreen) return false; - return uiElementIsVisible(el.parentNode); + return isOnScreen; } |