-
Notifications
You must be signed in to change notification settings - Fork 2k
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
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;
|
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
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).
Re: #18289
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: