yqking0320
yqking0320
  • 发布:2020-04-04 01:26
  • 更新:2020-04-10 10:07
  • 阅读:203

2.6.9.20200403版本 canvas使用问题

分类:HBuilderX

内容

android平台
1、uni.canvasToTempFilePath 无法使用,直接报错
2、画布绘制时,api与宽高有关的设置,大概率没有根据像素比缩放,但是偶尔会出现根据像素比缩放情况,但是比例失真
3、uni.canvasPutImageData 报错,错误内容见后面日志

支付宝小程序平台
CanvasContext.draw第一个参数设置false,下次绘制时,中心点、缩放比、旋转角度(translate、scale、rotate)等没有恢复默认值,ios、android、微信小程序平台测试正常

重现步骤

通过新旧版本对比,即可查看问题

2.6.9.20200403
2.6.8.20200330
IDE都是采用下载后的默认设置

示例下载地址
https://resource-aliyun.dcloud.net.cn/marketplace/fea8cea0-7666-11e9-90b8-79645450b653/plugin_example_ide.zip?v=1585672996

测试环境

[Android版]
5.1.1

[iOS版本号]
13.4

[手机型号]
vivo X6S A

附件

[可重现代码片段]

示例下载地址
https://resource-aliyun.dcloud.net.cn/marketplace/fea8cea0-7666-11e9-90b8-79645450b653/plugin_example_ide.zip?v=1585672996

联系方式

[QQ]
924515629

android报错日志

17:52:03.874 appServiceSDKScriptError
17:52:03.894 undefined is not an object (evaluating 'this.ctxCanvasPrv.draw'); at uni.canvasPutImageData
17:52:03.915 complete
17:52:03.936 oo@weex createInstanceContext:4:240869
17:52:03.956 ao@weex createInstanceContext:4:241075
17:52:03.977 weex createInstanceContext:4:211189
17:52:03.997 weex createInstanceContext:4:419539
17:52:04.017 weex createInstanceContext:4:419581
17:52:04.038 weex createInstanceContext:4:174710
17:52:04.058 promiseApi
17:52:04.078 _callee$
17:52:04.099 tryCatch
17:52:04.119 invoke
17:52:04.139 asyncGeneratorStep
17:52:04.160 _next
17:52:04.180 promiseReactionJob@[native code]
17:52:04.201 TypeError: Failed to construct 'ImageData': Illegal constructor
17:52:04.222 at TypeError (native)
17:52:04.242 at window.exparser.registerElement.methods.putImageData (uniapp://ready:182:360095)
17:52:04.263 at uniapp://ready:182:354351
17:52:04.283 at Array.forEach (native)
17:52:04.304 at uniapp://ready:182:354331
17:52:04.324 at t.(anonymous function) (uniapp://ready:182:89683)
17:52:04.344 at Object.subscribeHandler (uniapp://ready:182:1513)
17:52:04.364 at Object.A [as subscribeHandler] (uniapp://ready:1:9075)
17:52:04.404 webviewScriptError
17:52:04.425 Failed to construct 'ImageData': Illegal constructor
17:52:04.446 TypeError: Failed to construct 'ImageData': Illegal constructor
17:52:04.467 at TypeError (native)
17:52:04.487 at window.exparser.registerElement.methods.putImageData (uniapp://ready:182:360095)
17:52:04.507 at uniapp://ready:182:354351
17:52:04.527 at Array.forEach (native)
17:52:04.547 at uniapp://ready:182:354331
17:52:04.568 at t.(anonymous function) (uniapp://ready:182:89683)
17:52:04.588 at Object.subscribeHandler (uniapp://ready:182:1513)
17:52:04.608 at Object.A [as subscribeHandler] (uniapp://ready:1:9075)
17:52:04.648 Uncaught TypeError: Failed to construct 'ImageData': Illegal constructor at uniapp://ready:182

2020-04-04 01:26 负责人:无 分享
已邀请:
DCloud_UNI_WYQ

DCloud_UNI_WYQ

安卓端Bug已确认,感谢反馈。低版本安卓webview不支持使用new ImageData(),我们想法兼容一下。

问题2有简单的复现demo吗

支付宝小程序平台reserve参数只有设置是否保留上次绘制内容的效果,没有重置context中设置的fillStyle等属性的效果

要回复问题请先登录注册