mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-04-19 19:03:51 +00:00
Merge branch 'fix/preview_ratio' of https://github.com/ltdrdata/ComfyUI
This commit is contained in:
commit
d6d9b83447
@ -532,7 +532,17 @@ export class ComfyApp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.imageRects.push([x, y, cellWidth, cellHeight]);
|
this.imageRects.push([x, y, cellWidth, cellHeight]);
|
||||||
ctx.drawImage(img, x, y, cellWidth, cellHeight);
|
|
||||||
|
let wratio = cellWidth/img.width;
|
||||||
|
let hratio = cellHeight/img.height;
|
||||||
|
var ratio = Math.min(wratio, hratio);
|
||||||
|
|
||||||
|
let imgHeight = ratio * img.height;
|
||||||
|
let imgY = row * cellHeight + shiftY + (cellHeight - imgHeight)/2;
|
||||||
|
let imgWidth = ratio * img.width;
|
||||||
|
let imgX = col * cellWidth + shiftX + (cellWidth - imgWidth)/2;
|
||||||
|
|
||||||
|
ctx.drawImage(img, imgX, imgY, imgWidth, imgHeight);
|
||||||
ctx.filter = "none";
|
ctx.filter = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user