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

Fix that the reparented items outside mask clip rect still could be touched. #18039

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

dumganhar
Copy link
Contributor

When reattaching the current node, the masks of all its descendants need to be recalculated since IMask caches the index which means the distance to Mask node.

Reported at https://forum.cocos.org/t/topic/163455/238?u=dumganhar

There are two relevant PR requests:

1. #8313

This PR could not fix the issue totally, there is a currMask cache which will be used for all current node's descendants, but descendants's IMask may have different 'index' value which indicates the distance to the Mask node.

    public reattach (): void {
        let currMask;
        this.node.walk((node) => {
            if (!currMask) { // ----> Wrong cache logic here
                currMask = _searchComponentsInParent(node as Node, NodeEventProcessor._comp);
            }
            ......
        });
    }

2. #9363

This PR made _searchComponentsInParent as instance method but in 'reattach', it will always invoke '_searchComponentsInParent' for the current node.

企业微信截图_a9e50756-c792-4831-bb84-dd42a366edce

Re: #

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

…ouched.

When reattaching the current node, the masks of all its descendants need to be recalculated since IMask caches the index which means the distance to Mask node.

Reported at https://forum.cocos.org/t/topic/163455/238?u=dumganhar

There are two relevant PR requests:

## 1. cocos#8313

This PR could not fix the issue totally, there is a currMask cache which will be used for all current node's descendants, but descendants's IMask may have different 'index' value which indicates the distance to the Mask node.

    public reattach (): void {
        let currMask;
        this.node.walk((node) => {
            if (!currMask) {
                currMask = _searchComponentsInParent(node as Node, NodeEventProcessor._comp);
            }
            ......
        });
    }

## 2. cocos#9363

This PR made _searchComponentsInParent as instance method but  in 'reattach', it will always invoke '_searchComponentsInParent' for the current node.
@dumganhar dumganhar requested a review from minggo December 16, 2024 07:41
@dumganhar
Copy link
Contributor Author

@cocos-robot run test cases

Copy link

👍 Package size ⤵ -10 bytes, old: 5442450, new: 5442440

Interface Check Report

This pull request does not change any public interfaces !

Copy link

@dumganhar, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
web-mobile PASS PASS PASS
ios PASS PASS PASS
mac PASS PASS FAIL particle-2d-position-type-change keyboard-event,particle-2d-normal

Copy link

@dumganhar, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
windows PASS PASS FAIL keyboard-event,BuildTimeConstantsTest
android PASS PASS FAIL BuildTimeConstantsTest
wechatgame PASS FAIL FAIL

@minggo minggo merged commit 7340ce2 into cocos:v3.8.6 Dec 17, 2024
13 checks passed
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

Successfully merging this pull request may close these issues.

2 participants