| 246 | } |
| 247 | |
| 248 | VisualNode* |
| 249 | VisualNode::findNode(const NodeAllocator& na, int x, int y) { |
| 250 | VisualNode* cur = this; |
| 251 | int depth = y / Layout::dist_y; |
| 252 | |
| 253 | while (depth > 0 && cur != nullptr) { |
| 254 | if (cur->isHidden()) { |
| 255 | break; |
| 256 | } |
| 257 | VisualNode* oldCur = cur; |
| 258 | cur = nullptr; |
| 259 | for (unsigned int i=0; i<oldCur->getNumberOfChildren(); i++) { |
| 260 | VisualNode* nextChild = oldCur->getChild(na,i); |
| 261 | int newX = x - nextChild->getOffset(); |
| 262 | if (nextChild->containsCoordinateAtDepth(newX, depth - 1)) { |
| 263 | cur = nextChild; |
| 264 | x = newX; |
| 265 | break; |
| 266 | } |
| 267 | } |
| 268 | depth--; |
| 269 | y -= Layout::dist_y; |
| 270 | } |
| 271 | |
| 272 | if(cur == this && !cur->containsCoordinateAtDepth(x, 0)) { |
| 273 | return nullptr; |
| 274 | } |
| 275 | return cur; |
| 276 | } |
| 277 | |
| 278 | std::string |
| 279 | VisualNode::toolTip(NodeAllocator&, BestNode*, int, int) { |
no test coverage detected