fairygui/FairyGUI-cocos2dx

cocos2dx 组件设置遮罩 无法点击

Opened this issue · 0 comments

GObject* GComponent::hitTest(const Vec2& worldPoint, const Camera* camera)
{
if (_touchDisabled || !_touchable || !_displayObject->isVisible() || !_displayObject->getParent())
return nullptr;

GObject* target = nullptr;
if (_maskOwner)
{
    if (_maskOwner->hitTest(worldPoint, camera) != nullptr)
    {
        if (((FUIContainer*)_displayObject)->isInverted())
            return nullptr;
    }
    else
    {
        if (!((FUIContainer*)_displayObject)->isInverted())
            return nullptr;
    }
}

hitTest里面判断如果有遮罩 则_maskOwner->hitTest 但是_maskOwner本身displayobjet parent就为空 返回nullptr 永远走到else