onTouchStrat(e) {
this.data.beginX = e.touches[0].pageX
this.data.beginY = e.touches[0].pageY
if (this.data.hidePeople) {
this.setData({
hideNum: false,
})
}
},
onTouchMove(e) {
this.setData({
curX: e.touches[0].pageX - this.data.beginX + this.data.originX,
curY: e.touches[0].pageY - this.data.beginY + this.data.originY,
}, () => {
let cx = this.data.curX + this.data.centerW
let cy = this.data.curY + this.data.centerH
let xs = []
let ys = []
if (this.data.hidePeople) {
xs = this.data.numXs
ys = this.data.numYs
} else {
xs = this.data.peopleXs
ys = this.data.peopleYs
}
for (let i = 0; i < xs.length; i++) {
if (Math.sqrt(Math.pow(cx - xs[i], 2) + Math.pow(cy - ys[i], 2)) < this.data.centerW) {
if (this.data.firstIn) {
this.data.firstIn = false
wx.vibrateShort({
type: 'heavy'
})
}
return
}
}
if (!this.data.firstIn) {
this.data.firstIn = true
wx.vibrateShort({
type: 'medium'
})
}
})
},
onTouchStop(e) {
let cx = this.data.curX + this.data.centerW
let cy = this.data.curY + this.data.centerH
let xs = []
let ys = []
if (this.data.hidePeople) {
xs = this.data.numXs
ys = this.data.numYs
} else {
xs = this.data.peopleXs
ys = this.data.peopleYs
}
let i
for (i = 0; i < xs.length; i++) {
if (Math.sqrt(Math.pow(cx - xs[i], 2) + Math.pow(cy - ys[i], 2)) < this.data.centerW) {
this.data.firstIn = true
if (this.data.hidePeople) {
this.onSelectNum(this.data.chips[i])
} else {
this.onSelectPeople(this.data.peoples[i])
}
break;
}
}
this.setData({
hideNum: true,
curX: this.data.originX,
curY: this.data.originY,
})
},
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。