aboutsummaryrefslogtreecommitdiff
path: root/javascript/progressbar.js
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2023-01-15 20:20:29 +0300
committerAUTOMATIC <16777216c@gmail.com>2023-01-15 20:29:55 +0300
commitf6aac4c65a681383616f6e72e3865002600f476f (patch)
treeef4bcc4143fd7fb9e4206becab42376c963af516 /javascript/progressbar.js
parentce13ced5dc5ce06634b3313bbfed6d479f8a4538 (diff)
eliminate flicker for live previews
Diffstat (limited to 'javascript/progressbar.js')
-rw-r--r--javascript/progressbar.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/javascript/progressbar.js b/javascript/progressbar.js
index b7524ef7..8f22c018 100644
--- a/javascript/progressbar.js
+++ b/javascript/progressbar.js
@@ -184,15 +184,15 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
if(res.live_preview){
+
+ var rect = gallery.getBoundingClientRect()
+ if(rect.width){
+ livePreview.style.width = rect.width + "px"
+ livePreview.style.height = rect.height + "px"
+ }
+
var img = new Image();
img.onload = function() {
- var rect = gallery.getBoundingClientRect()
- if(rect.width){
- livePreview.style.width = rect.width + "px"
- livePreview.style.height = rect.height + "px"
- }
-
- livePreview.innerHTML = ''
livePreview.appendChild(img)
if(livePreview.childElementCount > 2){
livePreview.removeChild(livePreview.firstElementChild)