Fix progress bar position

This commit is contained in:
innovaciones 2022-09-20 13:05:25 -05:00 committed by AUTOMATIC1111
parent 3eaae8ae65
commit f183e09fcc

View File

@ -4,6 +4,7 @@ global_progressbar = null
onUiUpdate(function(){ onUiUpdate(function(){
progressbar = gradioApp().getElementById('progressbar') progressbar = gradioApp().getElementById('progressbar')
progressDiv = gradioApp().querySelectorAll('.progressDiv').length > 0;
if(progressbar!= null && progressbar != global_progressbar){ if(progressbar!= null && progressbar != global_progressbar){
global_progressbar = progressbar global_progressbar = progressbar
@ -17,11 +18,17 @@ onUiUpdate(function(){
if(txt2img_preview != null && txt2img_gallery != null){ if(txt2img_preview != null && txt2img_gallery != null){
txt2img_preview.style.width = txt2img_gallery.clientWidth + "px" txt2img_preview.style.width = txt2img_gallery.clientWidth + "px"
txt2img_preview.style.height = txt2img_gallery.clientHeight + "px" txt2img_preview.style.height = txt2img_gallery.clientHeight + "px"
if(!progressDiv){
progressbar.style.display = "none"
}
} }
if(img2img_preview != null && img2img_gallery != null){ if(img2img_preview != null && img2img_gallery != null){
img2img_preview.style.width = img2img_gallery.clientWidth + "px" img2img_preview.style.width = img2img_gallery.clientWidth + "px"
img2img_preview.style.height = img2img_gallery.clientHeight + "px" img2img_preview.style.height = img2img_gallery.clientHeight + "px"
if(!progressDiv){
progressbar.style.display = "none"
}
} }
window.setTimeout(requestMoreProgress, 500) window.setTimeout(requestMoreProgress, 500)
@ -35,6 +42,10 @@ function requestMoreProgress(){
if(btn==null) return; if(btn==null) return;
btn.click(); btn.click();
progressDiv = gradioApp().querySelectorAll('.progressDiv').length > 0;
if(progressDiv){
progressbar.style.display = "block"
}
} }
function requestProgress(){ function requestProgress(){
@ -43,4 +54,3 @@ function requestProgress(){
btn.click(); btn.click();
} }