mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
[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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user