Skip to content

[v3.8.6] Strip JSB relevant code in ui-opacity.ts for non-native platforms#18176

Merged
minggo merged 2 commits into
cocos:v3.8.6from
dumganhar:386-treeshake-in-uiopoacity
Jan 13, 2025
Merged

[v3.8.6] Strip JSB relevant code in ui-opacity.ts for non-native platforms#18176
minggo merged 2 commits into
cocos:v3.8.6from
dumganhar:386-treeshake-in-uiopoacity

Conversation

@dumganhar

@dumganhar dumganhar commented Jan 13, 2025

Copy link
Copy Markdown
Contributor

Re: #18056

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.

@dumganhar
dumganhar requested review from minggo and qiuguohua January 13, 2025 03:19
@dumganhar dumganhar changed the title [v3.8.6] Strip JSB relevant code in ui-opacity.ts for non-native plat… [v3.8.6] Strip JSB relevant code in ui-opacity.ts for non-native platforms Jan 13, 2025
@dumganhar
dumganhar force-pushed the 386-treeshake-in-uiopoacity branch from c4dbad2 to e54f325 Compare January 13, 2025 03:21
Comment thread cocos/2d/components/ui-opacity.ts Outdated
* @mangle
*/
private _parentOpacity: number = 1.0;
public _parentOpacity: number = 1.0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make it as public, then other engine module may use it too. I don't think it is a good idea. We can't just only consider package size.

@dumganhar dumganhar Jan 13, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But there are already lots of @engineInternal public properties or methods are allowed. How do we deal with those public methods or properties, should they be forbidden ?

WeChat64900c9bf2fc4747304e87d10656c4b3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node.ts

企业微信截图_3068ebbe-4d74-4484-8247-b657afab95f2

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a new internal method _setParentOpacity and revert _parentOpacity to private.

@github-actions

github-actions Bot commented Jan 13, 2025

Copy link
Copy Markdown

👍 Package size ⤵ -499 bytes, old: 5253635, new: 5253136

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -2950,25 +2950,8 @@
          * 透明度。
          */
         get opacity(): number;
         set opacity(value: number);
-        /**
-         * @en
-         * Recursively sets localopacity.
-         *
-         * @zh
-         * 递归设置localopacity。
-         *
-         * @param node @en recursive node.
-         *             @zh 递归的节点。
-         * @param dirty @en Is the color dirty.
-         *              @zh color是否dirty。
-         * @param parentOpacity @en The parent node's opacity.
-         *                      @zh 父节点的opacity。
-         * @param stopRecursiveIfHasOpacity @en Stop recursion if UiOpacity component exists.
-         *                                  @zh 如果存在UiOpacity组件则停止递归。
-         */
-        static setEntityLocalOpacityDirtyRecursively(node: Node, dirty: boolean, parentOpacity: number, stopRecursiveIfHasOpacity: boolean): void;
         protected _opacity: number;
         protected _getParentOpacity(node: Node): number;
         protected _parentChanged(): void;
         protected _setEntityLocalOpacityRecursively(opacity: number): void;

@minggo
minggo merged commit 49502e6 into cocos:v3.8.6 Jan 13, 2025
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.

3 participants