Fix touch listeners are not unsubscribed in MouseJoint.#18438
Merged
Conversation
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.
Code Size Check Report
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;
|
tangkaikk
reviewed
Mar 11, 2025
Contributor
There was a problem hiding this comment.
It seems that the typescript parent class does not need to add an override before the method.(typescript父类好像不需要在方法前加override.)
Contributor
Author
There was a problem hiding this comment.
They override methods in its parent (Component).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re: #18289
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: