fix the issue with incorrect js options on page load

add a setting for lightbox max size images
use setting for lightbox max size images late to let user change it and see results
This commit is contained in:
AUTOMATIC
2022-09-19 17:16:04 +03:00
parent bf1f3b8daf
commit 028fc25f28
3 changed files with 11 additions and 17 deletions

View File

@@ -71,6 +71,7 @@ function showGalleryImage(){
e.addEventListener('click', function (evt) {
if(!opts.js_modal_lightbox) return;
modalZoomSet(gradioApp().getElementById('modalImage'), opts.js_modal_lightbox_initialy_zoomed)
showModal(evt)
},true);
}
@@ -80,13 +81,17 @@ function showGalleryImage(){
}, 100);
}
function modalZoomToggle(event){
modalImage = gradioApp().getElementById("modalImage");
if( !modalImage.classList.contains('modalImageFullscreen') ){
function modalZoomSet(modalImage, enable){
if( enable ){
modalImage.classList.add('modalImageFullscreen');
}else{
} else{
modalImage.classList.remove('modalImageFullscreen');
}
}
function modalZoomToggle(event){
modalImage = gradioApp().getElementById("modalImage");
modalZoomSet(modalImage, !modalImage.classList.contains('modalImageFullscreen'))
event.stopPropagation()
}
@@ -101,18 +106,6 @@ onUiUpdate(function(){
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';
}
}
}
})
document.addEventListener("DOMContentLoaded", function() {