Skip to content

Commit 753fe4d

Browse files
committed
Merge branch 'patch-1' of https://github.com/kalo/cocos2d-iphone into v3.0
2 parents b1228d5 + 306df18 commit 753fe4d

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

cocos2d/CCResponderManager.m

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,31 +103,29 @@ - (void)buildResponderList
103103
_dirty = NO;
104104
}
105105

106-
-( void )buildResponderList:(CCNode *)node
106+
- (void)buildResponderList:(CCNode *)node
107107
{
108-
BOOL nodeAdded = NO;
109-
110108
// dont add invisible nodes
111109
if (!node.visible) return;
112110

113-
if ((node.children) && (node.children.count > 0))
111+
BOOL shouldAddNode = node.isUserInteractionEnabled;
112+
113+
if (node.children.count)
114114
{
115-
// scan through children, and build responderlist
115+
// scan through children, and build responder list
116116
for (CCNode *child in node.children)
117117
{
118-
if ((child.zOrder >= 0) && (!nodeAdded) && (node.isUserInteractionEnabled))
118+
if (shouldAddNode && child.zOrder >= 0)
119119
{
120120
[self addResponder:node];
121-
nodeAdded = YES;
121+
shouldAddNode = NO;
122122
}
123123
[self buildResponderList:child];
124124
}
125125
}
126-
else
127-
{
128-
// only add self
129-
if (node.isUserInteractionEnabled) [self addResponder:node];
130-
}
126+
127+
// if eligible, add the current node to the responder list
128+
if (shouldAddNode) [self addResponder:node];
131129
}
132130

133131
// -----------------------------------------------------------------

0 commit comments

Comments
 (0)