mirror of https://github.com/axmolengine/axmol.git
Merge pull request #14786 from liamcindy/v3_ui_widget
fix uiWidget clipping error with Node
This commit is contained in:
commit
830eb3433f
|
@ -961,7 +961,7 @@ bool Widget::hitTest(const Vec2 &pt, const Camera* camera, Vec3 *p) const
|
||||||
bool Widget::isClippingParentContainsPoint(const Vec2 &pt)
|
bool Widget::isClippingParentContainsPoint(const Vec2 &pt)
|
||||||
{
|
{
|
||||||
_affectByClipping = false;
|
_affectByClipping = false;
|
||||||
Widget* parent = getWidgetParent();
|
Node* parent = getParent();
|
||||||
Widget* clippingParent = nullptr;
|
Widget* clippingParent = nullptr;
|
||||||
while (parent)
|
while (parent)
|
||||||
{
|
{
|
||||||
|
@ -975,7 +975,7 @@ bool Widget::isClippingParentContainsPoint(const Vec2 &pt)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parent = parent->getWidgetParent();
|
parent = parent->getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_affectByClipping)
|
if (!_affectByClipping)
|
||||||
|
|
|
@ -114,6 +114,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIScrollView/Both");
|
searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIScrollView/Both");
|
||||||
searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIScrollView/Horizontal");
|
searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIScrollView/Horizontal");
|
||||||
searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIScrollView/Vertical");
|
searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIScrollView/Vertical");
|
||||||
|
searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIScrollView/ScrollViewAndButton");
|
||||||
searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UISlider");
|
searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UISlider");
|
||||||
searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UITextField");
|
searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UITextField");
|
||||||
searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIWidgetAddNode");
|
searchPaths.push_back("ccs-res/hd/cocosui/UIEditorTest/UIWidgetAddNode");
|
||||||
|
@ -155,6 +156,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
||||||
searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIScrollView/Both");
|
searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIScrollView/Both");
|
||||||
searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal");
|
searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIScrollView/Horizontal");
|
||||||
searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical");
|
searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIScrollView/Vertical");
|
||||||
|
searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIScrollView/ScrollViewAndButton");
|
||||||
searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UISlider");
|
searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UISlider");
|
||||||
searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UITextField");
|
searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UITextField");
|
||||||
searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIWidgetAddNode");
|
searchPaths.push_back("ccs-res/cocosui/UIEditorTest/UIWidgetAddNode");
|
||||||
|
|
|
@ -11,6 +11,7 @@ UIScrollViewEditorTests::UIScrollViewEditorTests()
|
||||||
ADD_TEST_CASE(UIScrollViewTest_Both_Editor);
|
ADD_TEST_CASE(UIScrollViewTest_Both_Editor);
|
||||||
// ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Editor);
|
// ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Editor);
|
||||||
// ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor);
|
// ADD_TEST_CASE(UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor);
|
||||||
|
ADD_TEST_CASE(UIScrollViewTest_ClippingWithNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// UIScrollViewTest_Vertical_Editor
|
// UIScrollViewTest_Vertical_Editor
|
||||||
|
@ -163,3 +164,29 @@ bool UIScrollViewTest_ScrollToPercentBothDirection_Bounce_Editor::init()
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UIScrollViewTest_Vertical_Editor
|
||||||
|
|
||||||
|
UIScrollViewTest_ClippingWithNode::UIScrollViewTest_ClippingWithNode()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
UIScrollViewTest_ClippingWithNode::~UIScrollViewTest_ClippingWithNode()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UIScrollViewTest_ClippingWithNode::init()
|
||||||
|
{
|
||||||
|
if (UIScene_Editor::init())
|
||||||
|
{
|
||||||
|
Node* node = CSLoader::createNode("cocosui/UIEditorTest/UIScrollView/ScrollViewAndButton/MainScene.csb");
|
||||||
|
_layout = static_cast<Layout*>(node);
|
||||||
|
_touchGroup->addChild(_layout);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
|
@ -100,4 +100,17 @@ protected:
|
||||||
cocos2d::ui::Text* _displayValueLabel;
|
cocos2d::ui::Text* _displayValueLabel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class UIScrollViewTest_ClippingWithNode : public UIScene_Editor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CREATE_FUNC(UIScrollViewTest_ClippingWithNode);
|
||||||
|
|
||||||
|
UIScrollViewTest_ClippingWithNode();
|
||||||
|
~UIScrollViewTest_ClippingWithNode();
|
||||||
|
|
||||||
|
virtual bool init() override;
|
||||||
|
protected:
|
||||||
|
cocos2d::ui::Text* _displayValueLabel;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__UIScrollViewTest_Editor__) */
|
#endif /* defined(__TestCpp__UIScrollViewTest_Editor__) */
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit bf3539cccfbeaa32e143fa07c73e4d1d715ab424
|
Subproject commit ed1fc877d3d58b1980d2602db68d14ce553ac0f9
|
Loading…
Reference in New Issue