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

Method getItemForTouch

core/2d/Menu.cpp:530–548  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

528}
529
530MenuItem* Menu::getItemForTouch(Touch* touch, const Camera* camera)
531{
532 Vec2 touchLocation = touch->getLocation();
533 for (const auto& item : _children)
534 {
535 MenuItem* child = dynamic_cast<MenuItem*>(item);
536 if (nullptr == child || false == child->isVisible() || false == child->isEnabled())
537 {
538 continue;
539 }
540 Rect rect;
541 rect.size = child->getContentSize();
542 if (isScreenPointInRect(touchLocation, camera, child->getWorldToNodeTransform(), rect, nullptr))
543 {
544 return child;
545 }
546 }
547 return nullptr;
548}
549
550void Menu::setOpacityModifyRGB(bool /*value*/) {}
551

Callers 2

onTouchBeganMethod · 0.95
onTouchMovedMethod · 0.95

Calls 6

isScreenPointInRectFunction · 0.85
getLocationMethod · 0.45
isVisibleMethod · 0.45
isEnabledMethod · 0.45
getContentSizeMethod · 0.45

Tested by

no test coverage detected