Compare commits

...
Author SHA1 Message Date
AUTOMATIC1111andGitHub 205ba6e116 Revert "add styles for image zoom"
This reverts commit 326236ed31.
2022-09-19 16:47:23 +03:00
AUTOMATIC1111andGitHub e88bb1db6b Revert "Add logic for zoom toggle"
This reverts commit 2f35b1c6be.
2022-09-19 16:47:23 +03:00
AUTOMATIC1111andGitHub 92dd5c1a9d Revert "initialize modal state from options"
This reverts commit 931e5aebb3.
2022-09-19 16:47:23 +03:00
AUTOMATIC1111andGitHub 45ea95a312 Revert "bring modal z-index above progress bar"
This reverts commit 86021511af.
2022-09-19 16:47:23 +03:00
AUTOMATIC1111andGitHub d1200f1670 Revert "Rely on opts being pre-populated"
This reverts commit bf1f3b8daf.
2022-09-19 16:47:23 +03:00
2 changed files with 11 additions and 53 deletions
+8 -36
View File
@@ -80,16 +80,6 @@ function showGalleryImage(){
}, 100);
}
function modalZoomToggle(event){
modalImage = gradioApp().getElementById("modalImage");
if( !modalImage.classList.contains('modalImageFullscreen') ){
modalImage.classList.add('modalImageFullscreen');
}else{
modalImage.classList.remove('modalImageFullscreen');
}
event.stopPropagation()
}
function galleryImageHandler(e){
if(e && e.parentElement.tagName == 'BUTTON'){
e.onclick = showGalleryImage;
@@ -97,44 +87,26 @@ function galleryImageHandler(e){
}
onUiUpdate(function(){
fullImg_preview = gradioApp().querySelectorAll('img.w-full')
if(fullImg_preview != null){
fullImg_preview.forEach(galleryImageHandler);
}
if(Object.keys(opts).length == 0) return;
if(!window.lightbox_settings_applied){
window.lightbox_settings_applied = true;
if(opts.js_modal_lightbox_initialy_zoomed){
var imageModal = gradioApp().getElementById('modalImage');
if(imageModal){
imageModal.className = 'modalImageFullscreen';
}
}
}
fullImg_preview = gradioApp().querySelectorAll('img.w-full')
if(fullImg_preview != null){
fullImg_preview.forEach(galleryImageHandler);
}
})
document.addEventListener("DOMContentLoaded", function() {
const modalFragment = document.createDocumentFragment();
const modal = document.createElement('div')
modal.onclick = closeModal;
modal.id = "lightboxModal";
modal.tabIndex=0
modal.addEventListener('keydown', modalKeyHandler, true)
const modalClose = document.createElement('span')
modalClose.className = 'modalClose cursor';
modalClose.innerHTML = '×'
modalClose.onclick = closeModal;
modal.id = "lightboxModal";
modal.tabIndex=0
modal.addEventListener('keydown', modalKeyHandler, true)
modal.appendChild(modalClose)
const modalZoom = document.createElement('span')
modalZoom.className = 'modalZoom cursor';
modalZoom.innerHTML = '⤡'
modalZoom.addEventListener('click', modalZoomToggle, true)
modal.appendChild(modalZoom)
const modalImage = document.createElement('img')
modalImage.id = 'modalImage';
modalImage.onclick = closeModal;
+3 -17
View File
@@ -236,7 +236,7 @@ input[type="range"]{
#lightboxModal{
display: none;
position: fixed;
z-index: 1001;
z-index: 900;
padding-top: 100px;
left: 0;
top: 0;
@@ -246,26 +246,17 @@ input[type="range"]{
background-color: rgba(20, 20, 20, 0.95);
}
.modalClose,
.modalZoom {
.modalClose {
color: white;
position: absolute;
top: 10px;
right: 25px;
font-size: 35px;
font-weight: bold;
cursor: pointer;
}
.modalZoom {
left: 10px;
right: auto;
}
.modalClose:hover,
.modalClose:focus,
.modalZoom:hover,
.modalZoom:focus {
.modalClose:focus {
color: #999;
text-decoration: none;
cursor: pointer;
@@ -279,11 +270,6 @@ input[type="range"]{
width: auto;
}
.modalImageFullscreen {
max-width: max-content;
height: 90%;
}
.modalPrev,
.modalNext {
cursor: pointer;