w***@qq.com
w***@qq.com
  • 发布:2024-03-07 14:10
  • 更新:2024-03-19 10:49
  • 阅读:453

【报Bug】ios 17.4 微信小程序 canvas 笔迹移动时,不连续问题

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 11

HBuilderX类型: 正式

HBuilderX版本号: 3.98

第三方开发者工具版本号: 1.06.24010120

基础库版本号: 3.3.4

项目创建方式: HBuilderX

示例代码:

<canvas class="handWriting" :disable-scroll="true" @touchstart="uploadScaleStart" @touchmove="uploadScaleMove" canvas-id="handWriting"></canvas>


// 笔迹开始  
            uploadScaleStart(e) {  
                this.startX = e.changedTouches[0].x  
                this.startY = e.changedTouches[0].y  
                //设置画笔参数  
                //画笔颜色  
                this.ctx.setStrokeStyle(this.lineColor)  
                //设置线条粗细  
                this.ctx.setLineWidth(this.lineSize)  
                //设置线条的结束端点样式  
                this.ctx.setLineCap("round") //'butt'、'round'、'square'  
                //开始画笔  
                this.ctx.beginPath()  
            },  

            // 笔迹移动  
            uploadScaleMove(e) {  
                //取点  
                let temX = e.changedTouches[0].x  
                let temY = e.changedTouches[0].y  
                //画线条  
                this.ctx.moveTo(this.startX, this.startY)  
                this.ctx.lineTo(temX, temY)  
                this.ctx.stroke()  
                this.startX = temX  
                this.startY = temY  
                this.ctx.draw(true)  
                this.isTouch = true  
            },

操作步骤:

<canvas class="handWriting" :disable-scroll="true" @touchstart="uploadScaleStart" @touchmove="uploadScaleMove" canvas-id="handWriting"></canvas>


// 笔迹开始  
            uploadScaleStart(e) {  
                this.startX = e.changedTouches[0].x  
                this.startY = e.changedTouches[0].y  
                //设置画笔参数  
                //画笔颜色  
                this.ctx.setStrokeStyle(this.lineColor)  
                //设置线条粗细  
                this.ctx.setLineWidth(this.lineSize)  
                //设置线条的结束端点样式  
                this.ctx.setLineCap("round") //'butt'、'round'、'square'  
                //开始画笔  
                this.ctx.beginPath()  
            },  

            // 笔迹移动  
            uploadScaleMove(e) {  
                //取点  
                let temX = e.changedTouches[0].x  
                let temY = e.changedTouches[0].y  
                //画线条  
                this.ctx.moveTo(this.startX, this.startY)  
                this.ctx.lineTo(temX, temY)  
                this.ctx.stroke()  
                this.startX = temX  
                this.startY = temY  
                this.ctx.draw(true)  
                this.isTouch = true  
            },

预期结果:

<canvas class="handWriting" :disable-scroll="true" @touchstart="uploadScaleStart" @touchmove="uploadScaleMove" canvas-id="handWriting"></canvas>


// 笔迹开始  
            uploadScaleStart(e) {  
                this.startX = e.changedTouches[0].x  
                this.startY = e.changedTouches[0].y  
                //设置画笔参数  
                //画笔颜色  
                this.ctx.setStrokeStyle(this.lineColor)  
                //设置线条粗细  
                this.ctx.setLineWidth(this.lineSize)  
                //设置线条的结束端点样式  
                this.ctx.setLineCap("round") //'butt'、'round'、'square'  
                //开始画笔  
                this.ctx.beginPath()  
            },  

            // 笔迹移动  
            uploadScaleMove(e) {  
                //取点  
                let temX = e.changedTouches[0].x  
                let temY = e.changedTouches[0].y  
                //画线条  
                this.ctx.moveTo(this.startX, this.startY)  
                this.ctx.lineTo(temX, temY)  
                this.ctx.stroke()  
                this.startX = temX  
                this.startY = temY  
                this.ctx.draw(true)  
                this.isTouch = true  
            },

实际结果:

<canvas class="handWriting" :disable-scroll="true" @touchstart="uploadScaleStart" @touchmove="uploadScaleMove" canvas-id="handWriting"></canvas>


// 笔迹开始  
            uploadScaleStart(e) {  
                this.startX = e.changedTouches[0].x  
                this.startY = e.changedTouches[0].y  
                //设置画笔参数  
                //画笔颜色  
                this.ctx.setStrokeStyle(this.lineColor)  
                //设置线条粗细  
                this.ctx.setLineWidth(this.lineSize)  
                //设置线条的结束端点样式  
                this.ctx.setLineCap("round") //'butt'、'round'、'square'  
                //开始画笔  
                this.ctx.beginPath()  
            },  

            // 笔迹移动  
            uploadScaleMove(e) {  
                //取点  
                let temX = e.changedTouches[0].x  
                let temY = e.changedTouches[0].y  
                //画线条  
                this.ctx.moveTo(this.startX, this.startY)  
                this.ctx.lineTo(temX, temY)  
                this.ctx.stroke()  
                this.startX = temX  
                this.startY = temY  
                this.ctx.draw(true)  
                this.isTouch = true  
            },

bug描述:

在ios 17.4的系统下,canvas画图断断续续,

2024-03-07 14:10 负责人:无 分享
已邀请:
d***@163.com

d***@163.com

大佬,解决了,我这也是这样

  • djy

    怎么解决的大佬

    2024-03-18 11:26

piaoyi_UI

piaoyi_UI - 【插件开发】【专治疑难杂症】【多款插件已上架:https://ext.dcloud.net.cn/publisher?id=193663(微信搜索飘逸科技UI小程序直接体验)】【骗子请绕道】问题咨询请加QQ群:120594820,代表作灵感实用工具小程序

试试我首页里面的插件看看,有没有这个问题,我测试过ios小程序端没有发现问题

  • d***@163.com

    一样,有这个问题,在ios最新的版本17.4里

    2024-03-11 13:51

离殇岁寒

离殇岁寒

垃圾IOS,蹲个后续

BeardYound

BeardYound

关闭页面下滑试试,确保是不是因为ios的惯性导致的

Y***@geely.com

Y***@geely.com

我是这么解决这个问题的 可以参考下 https://juejin.cn/post/7347616740853579826

w***@qq.com

w***@qq.com (作者)

感谢各位大佬

要回复问题请先登录注册