diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-22 08:02:14 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-22 08:02:14 +0000 |
commit | f6c52f4f41f4afe306b5adc90ba81feeca238e1a (patch) | |
tree | d6e87b07f474010f494c3869bb7d040c252ea7a2 /javascript/progressbar.js | |
parent | e8a9d213e4516a7fceead372da13e9b1bc454b4f (diff) | |
download | stable-diffusion-webui-gfx803-f6c52f4f41f4afe306b5adc90ba81feeca238e1a.tar.gz stable-diffusion-webui-gfx803-f6c52f4f41f4afe306b5adc90ba81feeca238e1a.tar.bz2 stable-diffusion-webui-gfx803-f6c52f4f41f4afe306b5adc90ba81feeca238e1a.zip |
for live previews, only hide gallery after at least one live previews pic has been received
fix blinking for live previews
fix a clientside live previews exception that happens when you kill serverside during sampling
match the size of live preview image to gallery image
Diffstat (limited to 'javascript/progressbar.js')
-rw-r--r-- | javascript/progressbar.js | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/javascript/progressbar.js b/javascript/progressbar.js index a7c69937..4a95077e 100644 --- a/javascript/progressbar.js +++ b/javascript/progressbar.js @@ -79,17 +79,17 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre divProgress.appendChild(divInner); parentProgressbar.insertBefore(divProgress, progressbarContainer); - if (gallery) { - var livePreview = document.createElement('div'); - livePreview.className = 'livePreview'; - gallery.insertBefore(livePreview, gallery.firstElementChild); - } + var livePreview = null; var removeProgressBar = function() { + if(! divProgress) return; + setTitle(""); parentProgressbar.removeChild(divProgress); if (gallery) gallery.removeChild(livePreview); atEnd(); + + divProgress = null; }; var funProgress = function(id_task) { @@ -149,8 +149,16 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre var funLivePreview = function(id_task, id_live_preview) { request("./internal/progress", {id_task: id_task, id_live_preview: id_live_preview}, function(res) { if (res.live_preview && gallery) { + + var img = new Image(); img.onload = function() { + if(!livePreview){ + livePreview = document.createElement('div'); + livePreview.className = 'livePreview'; + gallery.insertBefore(livePreview, gallery.firstElementChild); + } + livePreview.appendChild(img); if (livePreview.childElementCount > 2) { livePreview.removeChild(livePreview.firstElementChild); @@ -168,5 +176,9 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre }; funProgress(id_task, 0); - funLivePreview(id_task, 0); + + if(gallery){ + funLivePreview(id_task, 0); + } + } |