onLoad() {
cc.macro.ENABLE_MULTI_TOUCH = false;
this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
}
onTouchMove(event) {
event.target.position = event.target.position.add(event.getDelta());
if (this.node.position.sub(cc.v3()).mag() < 200) {
this.node.pauseSystemEvents(true);
cc.tween(this.node)
.to(2, { position: cc.v3() })
.call(() => {
this.node.resumeSystemEvents(true);
})
.start()
}
}
-
Creator 版本: 2.4.4
-
重现方式:在 pauseSystemEvents 和 resumeSystemEvents 之间松了手就再也接收不到任何事件了,如果 cc.macro.ENABLE_MULTI_TOUCH = true; 则没什么问题
-
建议:在 resumeSystemEvents 里能不能检查一下是否松了手,没有松手就继续保持 _CurrentTouchListener,还可以继续走 touchmove 而不被别的 touch 干涉,已经松手了就把_CurrentTouchListener清掉,这样就能继续后面的 touch 了,不能光靠 touchend 来清掉_CurrentTouchListener,我在 touchmove里pauseSystemEvents就再也不走 touchend 了