forked from mystiq/hydrogen-web
fix #204
This commit is contained in:
parent
1c4818cf1d
commit
a9a27133b9
1 changed files with 2 additions and 2 deletions
|
@ -44,8 +44,8 @@ export class ImageHandle {
|
|||
async scale(maxDimension) {
|
||||
const aspectRatio = this.width / this.height;
|
||||
const scaleFactor = Math.min(1, maxDimension / (aspectRatio >= 1 ? this.width : this.height));
|
||||
const scaledWidth = this.width * scaleFactor;
|
||||
const scaledHeight = this.height * scaleFactor;
|
||||
const scaledWidth = Math.round(this.width * scaleFactor);
|
||||
const scaledHeight = Math.round(this.height * scaleFactor);
|
||||
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = scaledWidth;
|
||||
|
|
Loading…
Reference in a new issue