eliminate flicker for live previews

This commit is contained in:
AUTOMATIC 2023-01-15 20:20:29 +03:00
parent ce13ced5dc
commit f6aac4c65a
2 changed files with 8 additions and 7 deletions

View file

@ -184,15 +184,15 @@ function requestProgress(id_task, progressbarContainer, gallery, atEnd, onProgre
if(res.live_preview){ if(res.live_preview){
var img = new Image();
img.onload = function() {
var rect = gallery.getBoundingClientRect() var rect = gallery.getBoundingClientRect()
if(rect.width){ if(rect.width){
livePreview.style.width = rect.width + "px" livePreview.style.width = rect.width + "px"
livePreview.style.height = rect.height + "px" livePreview.style.height = rect.height + "px"
} }
livePreview.innerHTML = '' var img = new Image();
img.onload = function() {
livePreview.appendChild(img) livePreview.appendChild(img)
if(livePreview.childElementCount > 2){ if(livePreview.childElementCount > 2){
livePreview.removeChild(livePreview.firstElementChild) livePreview.removeChild(livePreview.firstElementChild)

View file

@ -338,6 +338,7 @@ input[type="range"]{
} }
.livePreview img{ .livePreview img{
position: absolute;
object-fit: contain; object-fit: contain;
width: 100%; width: 100%;
height: 100%; height: 100%;