issue #2087: Small improvement in Node::removeAllEventListeners. Adding Node::_oldEventPriority property.

This commit is contained in:
James Chen 2013-09-18 13:01:53 +08:00
parent 3a5a1e6604
commit 241c0c8efc
2 changed files with 8 additions and 3 deletions

View File

@ -126,6 +126,8 @@ Node::Node(void)
, _isTransitionFinished(false) , _isTransitionFinished(false)
, _updateScriptHandler(0) , _updateScriptHandler(0)
, _componentContainer(NULL) , _componentContainer(NULL)
, _eventPriority(0)
, _oldEventPriority(0)
{ {
// set default scheduler and actionManager // set default scheduler and actionManager
Director *director = Director::getInstance(); Director *director = Director::getInstance();
@ -1307,9 +1309,11 @@ void Node::dissociateEventListener(EventListener* listener)
void Node::removeAllEventListeners() void Node::removeAllEventListeners()
{ {
auto dispatcher = EventDispatcher::getInstance();
for (auto& listener : _eventlisteners) for (auto& listener : _eventlisteners)
{ {
EventDispatcher::getInstance()->removeEventListener(listener); dispatcher->removeEventListener(listener);
} }
} }

View File

@ -1464,8 +1464,9 @@ protected:
ComponentContainer *_componentContainer; ///< Dictionary of components ComponentContainer *_componentContainer; ///< Dictionary of components
int _eventPriority; int _eventPriority; ///< The scene graph based priority of event listener.
static int _globalEventPriorityIndex; int _oldEventPriority; ///< The old scene graph based priority of event listener.
static int _globalEventPriorityIndex; ///< The index of global event priority.
}; };
//#pragma mark - NodeRGBA //#pragma mark - NodeRGBA