用bindtouchmove做元素view的缩放时,在安卓上,感觉明显的卡顿现象
发布于 5 年前 作者 tao61 1444 次浏览 来自 问答

用bindtouchmove做页面元素view的缩放时,

   

           

   

安卓上,感觉很明显的卡顿现象,手指移动离开后,过了大约500s才开始缩放,在ios上就很顺畅,社区的开发人员能解决一下么?在线等,着急…

moveEvent: function (e) {

   //单点触摸

   if (e.touches.length == 1) {

     console.log(‘单点’)

     return;

 

   } else if (e.touches.length == 2) {

     console.log(‘双点’)

let x = app.globalData.left;

     let y = app.globalData.top;

     let x1 = e.touches[0].pageX;

     let y1 = e.touches[0].pageY;

     let x2 = e.touches[1].pageX;

     let y2 = e.touches[1].pageY;

     let xMove = x2 - x1;

     let yMove = y2 - y1;

     let newDis = Math.sqrt(xMove * xMove + yMove * yMove);

     let newDistances = Math.sqrt(((e.touches[1].clientX - e.touches[0].clientX) * (e.touches[1].clientX - e.touches[0].clientX)) + ((e.touches[1].clientY - e.touches[0].clientY) * (e.touches[1].clientY - e.touches[0].clientY)));

     let distances = that.data.distances;

     let oldDis = that.data.distance;

     //let scale = newDis / oldDis;

     let scale = that.data.scale + 0.0003 * (newDistances - distances);

     console.log(scale);

   that.setData({

           scale: scale

 

         })

}

2 回复

哈哈哈同样遇到了,同样代码在iso端 移动图片正常,在Android 不正常。

返回的event对象数值 变化太大 上下变化大

遇到同样问题,会被设计打死,求解。

回到顶部