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
390ead18
Commit
390ead18
authored
Sep 21, 2022
by
Adam Snodgrass
Committed by
AUTOMATIC1111
Sep 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add button to toggle tiling images in the imageviewer modal
parent
5fb6f396
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
20 deletions
+71
-20
javascript/imageviewer.js
javascript/imageviewer.js
+46
-12
style.css
style.css
+25
-8
No files found.
javascript/imageviewer.js
View file @
390ead18
...
@@ -5,9 +5,13 @@ function closeModal() {
...
@@ -5,9 +5,13 @@ function closeModal() {
}
}
function
showModal
(
event
)
{
function
showModal
(
event
)
{
var
source
=
event
.
target
||
event
.
srcElement
;
const
source
=
event
.
target
||
event
.
srcElement
;
gradioApp
().
getElementById
(
"
modalImage
"
).
src
=
source
.
src
const
modalImage
=
gradioApp
().
getElementById
(
"
modalImage
"
)
var
lb
=
gradioApp
().
getElementById
(
"
lightboxModal
"
)
const
lb
=
gradioApp
().
getElementById
(
"
lightboxModal
"
)
modalImage
.
src
=
source
.
src
if
(
modalImage
.
style
.
display
===
'
none
'
)
{
lb
.
style
.
setProperty
(
'
background-image
'
,
'
url(
'
+
source
.
src
+
'
)
'
);
}
lb
.
style
.
display
=
"
block
"
;
lb
.
style
.
display
=
"
block
"
;
lb
.
focus
()
lb
.
focus
()
event
.
stopPropagation
()
event
.
stopPropagation
()
...
@@ -29,8 +33,13 @@ function modalImageSwitch(offset){
...
@@ -29,8 +33,13 @@ function modalImageSwitch(offset){
if
(
result
!=
-
1
){
if
(
result
!=
-
1
){
nextButton
=
galleryButtons
[
negmod
((
result
+
offset
),
galleryButtons
.
length
)]
nextButton
=
galleryButtons
[
negmod
((
result
+
offset
),
galleryButtons
.
length
)]
nextButton
.
click
()
nextButton
.
click
()
gradioApp
().
getElementById
(
"
modalImage
"
).
src
=
nextButton
.
children
[
0
].
src
const
modalImage
=
gradioApp
().
getElementById
(
"
modalImage
"
);
setTimeout
(
function
(){
gradioApp
().
getElementById
(
"
lightboxModal
"
).
focus
()},
10
)
const
modal
=
gradioApp
().
getElementById
(
"
lightboxModal
"
);
modalImage
.
src
=
nextButton
.
children
[
0
].
src
;
if
(
modalImage
.
style
.
display
===
'
none
'
)
{
modal
.
style
.
setProperty
(
'
background-image
'
,
`url(
${
modalImage
.
src
}
)`
)
}
setTimeout
(
function
(){
modal
.
focus
()},
10
)
}
}
}
}
}
}
...
@@ -95,6 +104,21 @@ function modalZoomToggle(event){
...
@@ -95,6 +104,21 @@ function modalZoomToggle(event){
event
.
stopPropagation
()
event
.
stopPropagation
()
}
}
function
modalTileImageToggle
(
event
){
const
modalImage
=
gradioApp
().
getElementById
(
"
modalImage
"
);
const
modal
=
gradioApp
().
getElementById
(
"
lightboxModal
"
);
const
isTiling
=
modalImage
.
style
.
display
===
'
none
'
;
if
(
isTiling
)
{
modalImage
.
style
.
display
=
'
block
'
;
modal
.
style
.
setProperty
(
'
background-image
'
,
'
none
'
)
}
else
{
modalImage
.
style
.
display
=
'
none
'
;
modal
.
style
.
setProperty
(
'
background-image
'
,
`url(
${
modalImage
.
src
}
)`
)
}
event
.
stopPropagation
()
}
function
galleryImageHandler
(
e
){
function
galleryImageHandler
(
e
){
if
(
e
&&
e
.
parentElement
.
tagName
==
'
BUTTON
'
){
if
(
e
&&
e
.
parentElement
.
tagName
==
'
BUTTON
'
){
e
.
onclick
=
showGalleryImage
;
e
.
onclick
=
showGalleryImage
;
...
@@ -116,17 +140,27 @@ document.addEventListener("DOMContentLoaded", function() {
...
@@ -116,17 +140,27 @@ document.addEventListener("DOMContentLoaded", function() {
modal
.
tabIndex
=
0
modal
.
tabIndex
=
0
modal
.
addEventListener
(
'
keydown
'
,
modalKeyHandler
,
true
)
modal
.
addEventListener
(
'
keydown
'
,
modalKeyHandler
,
true
)
const
modalClose
=
document
.
createElement
(
'
span
'
)
const
modalControls
=
document
.
createElement
(
'
div
'
)
modalClose
.
className
=
'
modalClose cursor
'
;
modalControls
.
className
=
'
modalControls gradio-container
'
;
modalClose
.
innerHTML
=
'
×
'
modal
.
append
(
modalControls
);
modalClose
.
onclick
=
closeModal
;
modal
.
appendChild
(
modalClose
)
const
modalZoom
=
document
.
createElement
(
'
span
'
)
const
modalZoom
=
document
.
createElement
(
'
span
'
)
modalZoom
.
className
=
'
modalZoom cursor
'
;
modalZoom
.
className
=
'
modalZoom cursor
'
;
modalZoom
.
innerHTML
=
'
⤡
'
modalZoom
.
innerHTML
=
'
⤡
'
modalZoom
.
addEventListener
(
'
click
'
,
modalZoomToggle
,
true
)
modalZoom
.
addEventListener
(
'
click
'
,
modalZoomToggle
,
true
)
modal
.
appendChild
(
modalZoom
)
modalControls
.
appendChild
(
modalZoom
)
const
modalTileImage
=
document
.
createElement
(
'
button
'
)
modalTileImage
.
className
=
'
modalTileImage gr-button gr-button-lg gr-button-secondary
'
;
modalTileImage
.
innerHTML
=
'
Preview Image Tiling
'
modalTileImage
.
addEventListener
(
'
click
'
,
modalTileImageToggle
,
true
)
modalControls
.
appendChild
(
modalTileImage
)
const
modalClose
=
document
.
createElement
(
'
span
'
)
modalClose
.
className
=
'
modalClose cursor
'
;
modalClose
.
innerHTML
=
'
×
'
modalClose
.
onclick
=
closeModal
;
modalControls
.
appendChild
(
modalClose
)
const
modalImage
=
document
.
createElement
(
'
img
'
)
const
modalImage
=
document
.
createElement
(
'
img
'
)
modalImage
.
id
=
'
modalImage
'
;
modalImage
.
id
=
'
modalImage
'
;
...
...
style.css
View file @
390ead18
...
@@ -246,22 +246,39 @@ input[type="range"]{
...
@@ -246,22 +246,39 @@ input[type="range"]{
background-color
:
rgba
(
20
,
20
,
20
,
0.95
);
background-color
:
rgba
(
20
,
20
,
20
,
0.95
);
}
}
.modalControls
{
display
:
grid
;
grid-template-columns
:
32px
auto
1
fr
32px
;
grid-template-areas
:
"zoom tile space close"
;
position
:
absolute
;
top
:
0
;
left
:
0
;
right
:
0
;
padding
:
16px
;
gap
:
16px
;
background-color
:
rgba
(
0
,
0
,
0
,
0.2
);
}
.modalClose
{
grid-area
:
close
;
}
.modalZoom
{
grid-area
:
zoom
;
}
.modalTileImage
{
grid-area
:
tile
;
}
.modalClose
,
.modalClose
,
.modalZoom
{
.modalZoom
{
color
:
white
;
color
:
white
;
position
:
absolute
;
top
:
10px
;
right
:
25px
;
font-size
:
35px
;
font-size
:
35px
;
font-weight
:
bold
;
font-weight
:
bold
;
cursor
:
pointer
;
cursor
:
pointer
;
}
}
.modalZoom
{
left
:
10px
;
right
:
auto
;
}
.modalClose
:hover
,
.modalClose
:hover
,
.modalClose
:focus
,
.modalClose
:focus
,
.modalZoom
:hover
,
.modalZoom
:hover
,
...
...
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