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

Method isClippingParentContainsPoint

core/ui/UIWidget.cpp:1037–1078  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1035}
1036
1037bool Widget::isClippingParentContainsPoint(const Vec2& pt)
1038{
1039 _affectByClipping = false;
1040 Node* parent = getParent();
1041 Widget* clippingParent = nullptr;
1042 while (parent)
1043 {
1044 Layout* layoutParent = dynamic_cast<Layout*>(parent);
1045 if (layoutParent)
1046 {
1047 if (layoutParent->isClippingEnabled())
1048 {
1049 _affectByClipping = true;
1050 clippingParent = layoutParent;
1051 break;
1052 }
1053 }
1054 parent = parent->getParent();
1055 }
1056
1057 if (!_affectByClipping)
1058 {
1059 return true;
1060 }
1061
1062 if (clippingParent)
1063 {
1064 bool bRet = false;
1065 auto camera = Camera::getVisitingCamera();
1066 // Camera isn't null means in touch begin process, otherwise use _hittedByCamera instead.
1067 if (clippingParent->hitTest(pt, (camera ? camera : _hittedByCamera), nullptr))
1068 {
1069 bRet = true;
1070 }
1071 if (bRet)
1072 {
1073 return clippingParent->isClippingParentContainsPoint(pt);
1074 }
1075 return false;
1076 }
1077 return true;
1078}
1079
1080void Widget::interceptTouchEvent(ax::ui::Widget::TouchEventType event, ax::ui::Widget* sender, Touch* touch)
1081{

Calls 4

getParentFunction · 0.50
isClippingEnabledMethod · 0.45
getParentMethod · 0.45
hitTestMethod · 0.45

Tested by

no test coverage detected