有layout的节点不能添加touch事件

  • Creator 版本:windows V2.1.3版本

我给有layout的组件添加touch事件 ,touch事件监听不到;
如果我去掉layout,事件就可以监听到;

难道就是不能监听?

@bigbear @jare

代码看看可以否。

onTouchEvent: function () {
this._root.on(cc.Node.EventType.TOUCH_START, this.touchBegan, this._root);
this._root.on(cc.Node.EventType.TOUCH_CANCEL, this.touchCancel, this._root);
this._root.on(cc.Node.EventType.TOUCH_END, this.touchEnd, this._root);
this._root.on(cc.Node.EventType.TOUCH_MOVE, this.touchMoved, this._root);
},

onLoad() {
this._root= this.node.getChildByName(“game”).getChildByName(“sourth”).getChildByName(“faceup”);;;
if (!this._root) {
return;
}
this.onTouchEvent();
this._root.on(‘touchstart’, (event) => {
event.stopPropagation();
}, this._root);
},
我去掉节点上的layout就可以监听了

原来是layout里面的item是带button组件的,会直接屏蔽掉touch事件