Commit 23ac0969 authored by 李维's avatar 李维

调整触摸事件

parent c62d35dd
...@@ -82,28 +82,25 @@ cc.Class({ ...@@ -82,28 +82,25 @@ cc.Class({
this.dragBtn.off(cc.Node.EventType.TOUCH_ENDED); this.dragBtn.off(cc.Node.EventType.TOUCH_ENDED);
this.dragBtn.on(cc.Node.EventType.TOUCH_ENDED, (e) => { this.dragBtn.on(cc.Node.EventType.TOUCH_ENDED, (e) => {
console.log("用户抬手-1"); // console.log("用户抬手-1");
if(this.userDragStart) { if(this.userDragStart) {
this.userDragStart = false; this.userDragStart = false;
this.node.emit('on_drag_button', false); this.node.emit('on_drag_button', false);
} }
}); });
this.dragBtn.off(cc.Node.EventType.MOUSE_UP);
this.dragBtn.on(cc.Node.EventType.MOUSE_UP, (e) => { this.dragBtn.on(cc.Node.EventType.MOUSE_UP, (e) => {
console.log("用户抬手-2"); // console.log("用户抬手-2");
if(this.userDragStart) { if(this.userDragStart) {
this.userDragStart = false; this.userDragStart = false;
this.node.emit('on_drag_button', false); this.node.emit('on_drag_button', false);
} }
}); });
cc.find('Canvas').on(cc.Node.EventType.TOUCH_ENDED, (e) => {
console.log("用户抬手-3"); this.dragBtn.off(cc.Node.EventType.TOUCH_CANCEL);
if(this.userDragStart) { this.dragBtn.on(cc.Node.EventType.TOUCH_CANCEL, (e) => {
this.userDragStart = false; // console.log("用户抬手-3");
this.node.emit('on_drag_button', false);
}
});
cc.find('Canvas').on(cc.Node.EventType.MOUSE_UP, (e) => {
console.log("用户抬手-4");
if(this.userDragStart) { if(this.userDragStart) {
this.userDragStart = false; this.userDragStart = false;
this.node.emit('on_drag_button', false); this.node.emit('on_drag_button', false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment