void EventDispatcher::resumeEventListenersForTarget(Node* target, bool recursive/* = false */) { auto listenerIter = _nodeListenersMap.find(target); if (listenerIter != _nodeListenersMap.end()) { auto listeners = listenerIter->second; for (auto& l : *listeners) { l->setPaused(false); } } for (auto& listener : _toAddedListeners) { if (listener->getAssociatedNode() == target) { listener->setPaused(false); } } setDirtyForNode(target); if (recursive) { const auto& children = target->getChildren(); for (const auto& child : children) { resumeEventListenersForTarget(child, true); } } }
void EventDispatcher::resumeTarget(Node* node) { auto listenerIter = _nodeListenersMap.find(node); if (listenerIter != _nodeListenersMap.end()) { auto listeners = listenerIter->second; for (auto& l : *listeners) { l->setPaused(false); } } setDirtyForNode(node); }
void EventDispatcher::setDirtyForNode(Node* node) { // Mark the node dirty only when there is an eventlistener associated with it. if (_nodeListenersMap.find(node) != _nodeListenersMap.end()) { _dirtyNodes.insert(node); } // Also set the dirty flag for node's children const auto& children = node->getChildren(); for (const auto& child : children) { setDirtyForNode(child); } }