| 215 | } |
| 216 | |
| 217 | void 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 | } |
nothing calls this directly
no test coverage detected