mp_canvas_drawer icon indicating copy to clipboard operation
mp_canvas_drawer copied to clipboard

在PC和测试环境下,图片能够完整显示,外网环境下,有概率图片只显示一部分

Open ALANXIAORUI opened this issue 5 years ago • 4 comments

ALANXIAORUI avatar Sep 18 '18 18:09 ALANXIAORUI

你是不是在onLoad里就开始绘制了,改成在onReady里绘制试试

JJYYZJY avatar Oct 29 '18 02:10 JJYYZJY

后来搞定了,是因为你在组件里面有个地方写了canvas的缺省长宽?然后我绘图有概率按那个长宽绘制了,改了它那里就OK

ALANXIAORUI avatar Oct 29 '18 13:10 ALANXIAORUI

是有这个问题,只需要吧drawImage函数中的if (deg !== 0) {}中的处理注释就好了, drawImage (params) { this.ctx.save() const { url, top = 0, left = 0, width = 0, height = 0, borderRadius = 0, deg = 0 } = params // if (borderRadius) { // this.ctx.beginPath() // this.ctx.arc(left + borderRadius, top + borderRadius, borderRadius, 0, 2 * Math.PI) // this.ctx.clip() // this.ctx.drawImage(url, left, top, width, height) // } else { if (deg !== 0) { // this.ctx.translate(left + width/2, top + height/2) // this.ctx.rotate(deg * Math.PI / 180) // this.ctx.drawImage(url, -width/2, -height/2, width, height) } else { this.ctx.drawImage(url, left, top, width, height) } // } this.ctx.restore() },

stringworld avatar Jan 18 '19 09:01 stringworld

有人解决这个问题吗?目前也有小概率发生

HelloKitty-cat avatar Apr 15 '19 07:04 HelloKitty-cat