Skip to content

Commit 6ba07e3

Browse files
committed
Reset transform to the identity matrix.
1 parent 4484590 commit 6ba07e3

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

js/load-image-scale.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
destWidth,
105105
destHeight
106106
)
107-
return canvas
107+
return ctx
108108
}
109109

110110
// Determines if the target image should be a canvas element:
@@ -303,17 +303,20 @@
303303
canvas.style.width = canvas.width / pixelRatio + 'px'
304304
canvas.style.height = canvas.height / pixelRatio + 'px'
305305
}
306-
return loadImage.drawImage(
307-
img,
308-
canvas,
309-
sourceX,
310-
sourceY,
311-
sourceWidth,
312-
sourceHeight,
313-
destWidth,
314-
destHeight,
315-
options
316-
)
306+
loadImage
307+
.drawImage(
308+
img,
309+
canvas,
310+
sourceX,
311+
sourceY,
312+
sourceWidth,
313+
sourceHeight,
314+
destWidth,
315+
destHeight,
316+
options
317+
)
318+
.setTransform(1, 0, 0, 1, 0, 0) // reset to the identity matrix
319+
return canvas
317320
}
318321
img.width = destWidth
319322
img.height = destHeight

0 commit comments

Comments
 (0)