关于在打开摄像头后使用canvas绘制的问题
- 当前 Bug 的表现(可附上截图)打开摄像头,利用canvas绘制矩形,在开发者工具中可显示,真机调试不显示
-
预期表现 : 真机调试也可看见矩形框
-
复现路径
-
提供一个最简复现 Demo
<camera flash=“off” binderror=“error” style=“width: 100%; height: {{winHeight}}rpx;”>
<canvas canvas-id=“rectangle” style=“width: 100%; height: {{winHeight}}rpx;”></canvas>
</camera>
onReady: function () {
var that = this;
wx.getSystemInfo({
success: function (res) {
let winWidth = res.screenWidth;
console.log(res)
let scale = winWidth / 375;
let winHeight = ((res.screenHeight-120) * 2 / scale);
console.log(“winHeight:” + winHeight)
that.setData({
winHeight: winHeight,
})
var rec = wx.createCanvasContext(“rectangle”);
rec.setStrokeStyle(‘red’)
rec.strokeRect(res.screenWidth- 10, 10, 20, res.screenHeight - 140 )
rec.draw(true)
console.log(rec)
},
})
},
