(fix)修复hold+swipe时,第二指放开进入初始化状态的错误

This commit is contained in:
wangchangqi 2022-10-08 16:00:46 +08:00
parent 147725dc7b
commit d0881cb166
1 changed files with 8 additions and 1 deletions

View File

@ -1309,7 +1309,14 @@ export default class GestureDector {
touchmove: null,
touchend: (evt, touch) => {
// if (touch?.identifier !== this.touch1ID) return
const isSecondFinger = evt.touches[1] === touch
let isSecondFinger = false
// 判断当前是否是第二指,需满足以下:
// 1. 当前传入的 touch 的 id 为 1代表是第2指
// 2. 当前事件的变更触摸列表的第1项和传入的 touch 相同
if (touch?.identifier === 1 && evt.changedTouches[0] === touch) {
isSecondFinger = true
}
debugInfo('SWIPE-STARTED-STATE---touchend')
// 一旦进入 swipeState 状态,则必发布事件