Android上canvas滑动到控件外,touchend不触发

发布于 7 年前作者 yang315313 次浏览最后编辑 7 年前来自 ask

 Android上canvas滑动到控件外,touchend不触发,iPhone上没有问题。

极容易复现


(xml代码)

<view class="container">


<canvas canvas-id="canvasId1" style="width:200prx;height:200prx;background:#222;" bindtouchstart='touch1' bindtouchmove='touch1'bindtouchend='touch1' bindtouchcancel='touch1'></canvas>


<canvas canvas-id="canvasId2" style="width:200prx;height:200prx;background:#f42;margin-top:30rpx" bindtouchstart='touch2'bindtouchmove='touch2' bindtouchend='touch2' bindtouchcancel='touch2'></canvas>

<view>{{msg}}</view>


</view>


(js代码)


Page({

data: {

msg:""

},

//事件处理函数

touch1: function(e) {

let msg = "canvas1:"+ e.type + " x:"+ parseInt(e.changedTouches[0].x) + " y:" +parseInt(e.changedTouches[0].y)

console.log(msg)

this.showMsg(msg)

},

touch2: function (e) {

let msg = "canvas2:" + e.type + " x:" + parseInt(e.changedTouches[0].x)+ " y:" + parseInt(e.changedTouches[0].y)

console.log(msg)

this.showMsg(msg)

},


showMsg:function(msg){

this.setData({

msg:msg

})

}

})

2 回复
wuxia
wuxia1 楼6 年前

你好,麻烦提供能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)

gongna
gongna2 楼5 年前

您好,请问解决了吗?