I’m new to cocos so may be it is very easy question, however, how to make parent layer untouchable, and stop further propagation of touches to its children? For example to make all scene untouchable.
setTouchEnabled works only for “this” Layer, not for “this” and all its children, also i don’t want to register listener with fixed priority and swallow touches, it’s too tedious.
Thanks!
Can always write your own wrapper.
void setTouchEnabledAllChildren(bool enabled, Node* parent) {
for(auto c : parent->getChildren()) {
// may need to filter out only ui::Widget and MenuItem?
c->setTouchEnabled(enabled)
}
}
This is good idea, but this will make untouchable only children from current Layer, not also children from children from current Layer and so on.
_eventDispatcher->pauseEventListenersForTarget( this, true ); should do the trick
1 Like
Well you just have to extrapolate into whatever you need. You could easily recurse after setting.
Hopefully @hawkwood’s suggestion works!
YES, this is what i need, thanks guys!!!