Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
fe7bcbe3
Commit
fe7bcbe3
authored
May 19, 2023
by
AUTOMATIC1111
Committed by
GitHub
May 19, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10534 from thot-experiment/dev
rewrite uiElementIsVisible
parents
8c1148b9
7b61acbd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
javascript/dragdrop.js
javascript/dragdrop.js
+4
-1
script.js
script.js
+15
-13
No files found.
javascript/dragdrop.js
View file @
fe7bcbe3
...
...
@@ -81,7 +81,10 @@ window.addEventListener('paste', e => {
}
const
visibleImageFields
=
[...
gradioApp
().
querySelectorAll
(
'
[data-testid="image"]
'
)]
.
filter
(
el
=>
uiElementIsVisible
(
el
));
.
filter
(
el
=>
uiElementIsVisible
(
el
))
.
sort
((
a
,
b
)
=>
uiElementInSight
(
b
)
-
uiElementInSight
(
a
));
if
(
!
visibleImageFields
.
length
)
{
return
;
}
...
...
script.js
View file @
fe7bcbe3
...
...
@@ -92,19 +92,21 @@ document.addEventListener('keydown', function(e) {
* 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
;
if
(
el
===
document
)
{
return
true
;
}
while
((
isVisible
=
el
.
closest
(
'
.tabitem
'
)?.
style
.
display
)
!==
'
none
'
)
{
if
(
!
isVisible
)
{
return
false
;
}
else
if
(
el
.
parentElement
)
{
el
=
el
.
parentElement
;
}
else
{
break
;
}
}
return
isVisible
;
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
isOnScreen
=
clRect
.
bottom
>
0
&&
clRect
.
top
<
windowHeight
;
return
isOnScreen
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment