MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / itemForTouch

Method itemForTouch

Source/Node/Menu.cpp:109–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109Node* Menu::itemForTouch(Touch* touch) {
110 Vec2 worldLocation = this->convertToWorldSpace(touch->getLocation());
111 if (_children && !_children->isEmpty()) {
112 for (int i = s_cast<int>(_children->getCount()) - 1; i >= 0; i--) {
113 Node* childItem = _children->get(i)->to<Node>();
114 if (childItem && childItem->isVisible() && childItem->isTouchEnabled()) {
115 Vec2 local = childItem->convertToNodeSpace(worldLocation);
116 if (Rect(Vec2::zero, childItem->getSize()).containsPoint(local)) {
117 return getTouchedItem(childItem, worldLocation);
118 }
119 }
120 }
121 }
122 return nullptr;
123}
124
125NS_DORA_END

Callers

nothing calls this directly

Calls 12

getTouchedItemFunction · 0.85
convertToWorldSpaceMethod · 0.80
getLocationMethod · 0.80
isTouchEnabledMethod · 0.80
convertToNodeSpaceMethod · 0.80
getMethod · 0.65
RectClass · 0.50
isEmptyMethod · 0.45
getCountMethod · 0.45
isVisibleMethod · 0.45
containsPointMethod · 0.45
getSizeMethod · 0.45

Tested by

no test coverage detected