Skip to content

Commit 306df18

Browse files
committed
fixed buildResponderList: in CCResponderManager
previously *buildResponderList:* overlooked adding the current node to the responder list if the node *only* contained children with a negative z-index while having interactions enabled. flagging the node for possible addition, then eventually adding it should patch this. and some minimisations.
1 parent 2cd5c4d commit 306df18

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)