Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cocos2dx 组件设置遮罩 无法点击 #108

Open
xianzhiliao opened this issue Feb 21, 2023 · 0 comments
Open

cocos2dx 组件设置遮罩 无法点击 #108

xianzhiliao opened this issue Feb 21, 2023 · 0 comments

Comments

@xianzhiliao
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant