提交 b380db25 编写于 作者: D DCloud_LXH

fix: canvas 触发 resize 导致延迟绘图时canvas变化 fixed #2847

上级 1cbf40c3
......@@ -133,12 +133,13 @@ export default {
method(data)
}
},
_resize () {
_resize (size) {
var canvas = this.$refs.canvas
var hasChanged = !size || (canvas.width !== size.width * pixelRatio || canvas.height !== size.height * pixelRatio)
if (canvas.width > 0 && canvas.height > 0) {
var context = canvas.getContext('2d')
var imageData = context.getImageData(0, 0, canvas.width, canvas.height)
wrapper(canvas)
hasChanged && 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.
先完成此消息的编辑!
想要评论请 注册