提交 7a63180b 编写于 作者: D DCloud_LXH

chore: canvas resize

上级 b380db25
......@@ -136,10 +136,11 @@ export default {
_resize (size) {
var canvas = this.$refs.canvas
var hasChanged = !size || (canvas.width !== size.width * pixelRatio || canvas.height !== size.height * pixelRatio)
if (!hasChanged) return
if (canvas.width > 0 && canvas.height > 0) {
var context = canvas.getContext('2d')
var imageData = context.getImageData(0, 0, canvas.width, canvas.height)
hasChanged && wrapper(canvas)
wrapper(canvas)
context.putImageData(imageData, 0, 0)
} else {
wrapper(canvas)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册