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 touch listeners are not unsubscribed in MouseJoint. #18438

Merged
merged 8 commits into from
Mar 11, 2025

Conversation

dumganhar
Copy link
Contributor

Re: #18289

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.

gt3mb and others added 3 commits March 11, 2025 13:42
This code ensures that all touch event listeners (TOUCH_START, TOUCH_MOVE, TOUCH_END, and TOUCH_CANCEL) attached to the Canvas node are properly removed when the MouseJoint component is destroyed.

Purpose:
Prevents touch event listeners from remaining in memory after the MouseJoint is destroyed.
Avoids unexpected behavior caused by lingering event handlers that could still trigger interactions.
Improves memory management and performance by ensuring proper cleanup of event listeners.
@dumganhar dumganhar closed this Mar 11, 2025
Copy link

github-actions bot commented Mar 11, 2025

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1001924 bytes 1001924 bytes ✅ 0 bytes
2D All (legacy pipeline) 2662922 bytes 2663068 bytes ⚠️ +146 bytes
2D All (new pipeline) 2750151 bytes 2750297 bytes ⚠️ +146 bytes
(2D + 3D) All 10003451 bytes 10003670 bytes ⚠️ +219 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16915785 bytes 16916004 bytes ⚠️ +219 bytes

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -48230,9 +48230,9 @@
          * 最大阻力值。
          */
         get maxForce(): number;
         set maxForce(v: number);
-        update(dt: any): void;
+        update(dt: number): void;
     }
     export class RelativeJoint2D extends Joint2D {
         TYPE: EJoint2DType;
         /**
@@ -69807,8 +69807,12 @@
         export interface _cocos_physics_2d_spec_i_physics_joint__IJoint2D extends _cocos_physics_spec_i_lifecycle__ILifecycle {
             readonly impl: any;
             apply(): void;
             initialize(v: Joint2D): void;
+            onEnable?(): void;
+            onDisable?(): void;
+            start?(): void;
+            onDestroy?(): void;
         }
         export interface _cocos_physics_spec_i_physics_world__IRaycastOptions {
             mask: number;
             group: number;

@dumganhar dumganhar reopened this Mar 11, 2025
@dumganhar dumganhar mentioned this pull request Mar 11, 2025
6 tasks
@dumganhar dumganhar requested a review from tangkaikk March 11, 2025 06:27
@dumganhar dumganhar marked this pull request as draft March 11, 2025 06:30
@dumganhar dumganhar marked this pull request as ready for review March 11, 2025 09:01
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that the typescript parent class does not need to add an override before the method.(typescript父类好像不需要在方法前加override.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They override methods in its parent (Component).

@dumganhar dumganhar merged commit 48308cd into cocos:v3.8.6 Mar 11, 2025
14 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.

3 participants