求教贴,请问【如何不阻止事件透传】?

需求:

注册 node.on(cc.Node.EventType.TOUCH_START) 时,会阻止事件传递。事实上我并没有e.stopPropagation(),请问哪位大佬能解答下?

目前我的解决方式:


// 注册事件
this.maskNode.on(cc.Node.EventType.TOUCH_START, () => void 0)

// 通过hack的方式,让节点可以穿透
this.maskNode['_hitTest'] = () => {
      // 这里是正常我要做的事情
      if (this._activeNode) {
        this._activeNode.active = false
        this._activeNode = undefined
      }
      return false
}

1赞

可能是你的节点有一个button组件

试试添加这行代码在注册触摸事件之后
this.maskNode["_touchListener"].setSwallowTouches(false);

1赞