[v3.8.6] Optimize code size for pointer-event-dispatcher.ts. (#18220)

addPointerEventProcessor, removePointerEventProcessor, dispatchEventMouse, dispatchEventTouch don't need to be public.
This commit is contained in:
James Chen
2025-01-21 09:26:30 +08:00
committed by GitHub
parent e652d6ed95
commit d8eb4f6b53
+7 -5
View File
@@ -76,7 +76,7 @@ class PointerEventDispatcher implements IEventDispatcher {
return true;
}
public addPointerEventProcessor (pointerEventProcessor: NodeEventProcessor): void {
private addPointerEventProcessor (pointerEventProcessor: NodeEventProcessor): void {
if (this._inDispatchCount === 0) {
if (!this._pointerEventProcessorList.includes(pointerEventProcessor)) {
this._pointerEventProcessorList.push(pointerEventProcessor);
@@ -88,7 +88,7 @@ class PointerEventDispatcher implements IEventDispatcher {
js.array.remove(this._processorListToRemove, pointerEventProcessor);
}
public removePointerEventProcessor (pointerEventProcessor: NodeEventProcessor): void {
private removePointerEventProcessor (pointerEventProcessor: NodeEventProcessor): void {
if (this._inDispatchCount === 0) {
js.array.remove(this._pointerEventProcessorList, pointerEventProcessor);
this._isListDirty = true;
@@ -98,7 +98,7 @@ class PointerEventDispatcher implements IEventDispatcher {
js.array.remove(this._processorListToAdd, pointerEventProcessor);
}
public dispatchEventMouse (eventMouse: EventMouse): boolean {
private dispatchEventMouse (eventMouse: EventMouse): boolean {
this._inDispatchCount++;
this._sortPointerEventProcessorList();
const pointerEventProcessorList = this._pointerEventProcessorList;
@@ -122,7 +122,7 @@ class PointerEventDispatcher implements IEventDispatcher {
return dispatchToNextEventDispatcher;
}
public dispatchEventTouch (eventTouch: EventTouch): boolean {
private dispatchEventTouch (eventTouch: EventTouch): boolean {
this._inDispatchCount++;
this._sortPointerEventProcessorList();
const pointerEventProcessorList = this._pointerEventProcessorList;
@@ -236,7 +236,9 @@ class PointerEventDispatcher implements IEventDispatcher {
if (p1.cachedCameraPriority !== p2.cachedCameraPriority) {
return p2.cachedCameraPriority - p1.cachedCameraPriority;
}
let n1: Node | null = node1; let n2: Node | null = node2; let ex = false;
let n1: Node | null = node1;
let n2: Node | null = node2;
let ex = false;
while (n1!.parent?.uuid !== n2!.parent?.uuid) {
n1 = n1?.parent?.parent === null ? (ex = true) && node2 : n1 && n1.parent;
n2 = n2?.parent?.parent === null ? (ex = true) && node1 : n2 && n2.parent;