MCPcopy Create free account
hub / github.com/axmolengine/axmol / visitTarget

Method visitTarget

core/base/EventDispatcher.cpp:217–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217void EventDispatcher::visitTarget(Node* node, bool isRootNode)
218{
219 auto* protectedNode = dynamic_cast<ProtectedNode*>(node);
220 if (protectedNode)
221 {
222 protectedNode->sortAllProtectedChildren();
223 protectedNode->sortAllChildren();
224
225 const auto& children = protectedNode->getChildren();
226 const auto& protectedChildren = protectedNode->getProtectedChildren();
227
228 const auto childrenCount = children.size();
229 const auto protectedChildrenCount = protectedChildren.size();
230
231 if (childrenCount > 0 || protectedChildrenCount > 0)
232 {
233 int childIndex = 0;
234 int protectedChildIndex = 0;
235 Node* child = nullptr;
236 // visit children zOrder < 0
237 for (; childIndex < childrenCount; childIndex++)
238 {
239 child = children.at(childIndex);
240
241 if (child && child->getLocalZOrder() < 0)
242 visitTarget(child, false);
243 else
244 break;
245 }
246
247 for (; protectedChildIndex < protectedChildrenCount; protectedChildIndex++)
248 {
249 child = protectedChildren.at(protectedChildIndex);
250
251 if (child && child->getLocalZOrder() < 0)
252 visitTarget(child, false);
253 else
254 break;
255 }
256
257 if (_nodeListenersMap.find(node) != _nodeListenersMap.end())
258 {
259 _globalZOrderNodeMap[node->getGlobalZOrder()].emplace_back(node);
260 }
261
262 for (; childIndex < childrenCount; childIndex++)
263 {
264 child = children.at(childIndex);
265 if (child)
266 visitTarget(child, false);
267 }
268
269 for (; protectedChildIndex < protectedChildrenCount; protectedChildIndex++)
270 {
271 child = protectedChildren.at(protectedChildIndex);
272 if (child)
273 visitTarget(child, false);
274 }

Callers

nothing calls this directly

Calls 10

sortAllChildrenMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45
findMethod · 0.45
endMethod · 0.45
emplace_backMethod · 0.45
reserveMethod · 0.45
beginMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected