mirror of https://github.com/axmolengine/axmol.git
Merge pull request #13884 from yangws/v3
Fix bug: in Widget::isClippingParentContainsPoint, _hittedByCamera may be null.
This commit is contained in:
commit
1eeafed072
|
@ -772,8 +772,8 @@ bool Widget::onTouchBegan(Touch *touch, Event *unusedEvent)
|
|||
auto camera = Camera::getVisitingCamera();
|
||||
if(hitTest(_touchBeganPosition, camera, nullptr))
|
||||
{
|
||||
_hittedByCamera = camera;
|
||||
if (isClippingParentContainsPoint(_touchBeganPosition)) {
|
||||
_hittedByCamera = camera;
|
||||
_hitted = true;
|
||||
}
|
||||
}
|
||||
|
@ -976,7 +976,9 @@ bool Widget::isClippingParentContainsPoint(const Vec2 &pt)
|
|||
if (clippingParent)
|
||||
{
|
||||
bool bRet = false;
|
||||
if (clippingParent->hitTest(pt, _hittedByCamera, nullptr))
|
||||
auto camera = Camera::getVisitingCamera();
|
||||
// Camera isn't null means in touch begin process, otherwise use _hittedByCamera instead.
|
||||
if (clippingParent->hitTest(pt, (camera ? camera : _hittedByCamera), nullptr))
|
||||
{
|
||||
bRet = true;
|
||||
}
|
||||
|
|
|
@ -430,6 +430,7 @@ bool Issue12692::init()
|
|||
Size widgetSize = _widget->getContentSize();
|
||||
|
||||
auto label = Text::create("Issue 12692", "fonts/Marker Felt.ttf", 32);
|
||||
label->setName("Text Title");
|
||||
label->setAnchorPoint(Vec2(0.5f, -1.0f));
|
||||
label->setPosition(Vec2(widgetSize.width / 2.0f,
|
||||
widgetSize.height / 2.0f + label->getContentSize().height * 1.5f));
|
||||
|
@ -437,6 +438,7 @@ bool Issue12692::init()
|
|||
|
||||
|
||||
Text* alert = Text::create("ListView in ListView enable Scissor Clipping", "fonts/Marker Felt.ttf", 20);
|
||||
alert->setName("Text Alert");
|
||||
alert->setColor(Color3B(159, 168, 176));
|
||||
alert->setPosition(Vec2(widgetSize.width / 2.0f,
|
||||
widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f));
|
||||
|
@ -495,7 +497,7 @@ bool Issue12692::init()
|
|||
}
|
||||
{
|
||||
Button* default_button = Button::create("cocosui/backtotoppressed.png", "cocosui/backtotopnormal.png");
|
||||
default_button->setName("Title Button");
|
||||
default_button->setName("Title Button 2");
|
||||
|
||||
Layout* default_item = Layout::create();
|
||||
default_item->setTouchEnabled(true);
|
||||
|
@ -529,7 +531,6 @@ bool Issue8316::init()
|
|||
widgetSize.height / 2.0f + label->getContentSize().height * 1.5f));
|
||||
_uiLayer->addChild(label);
|
||||
|
||||
|
||||
Text* alert = Text::create("ListView Disable Touch", "fonts/Marker Felt.ttf", 20);
|
||||
alert->setColor(Color3B(159, 168, 176));
|
||||
alert->setPosition(Vec2(widgetSize.width / 2.0f,
|
||||
|
|
Loading…
Reference in New Issue