mirror of
https://github.com/troisjs/trois.git
synced 2024-11-24 04:12:02 +08:00
remove optional chaining (#42)
This commit is contained in:
parent
7261af9f9f
commit
0f0fe659af
@ -84,13 +84,13 @@ export default function usePointer(options) {
|
|||||||
const enterEvent = { ...overEvent, type: 'pointerenter' };
|
const enterEvent = { ...overEvent, type: 'pointerenter' };
|
||||||
onIntersectOver(overEvent);
|
onIntersectOver(overEvent);
|
||||||
onIntersectEnter(enterEvent);
|
onIntersectEnter(enterEvent);
|
||||||
component.onPointerOver?.(overEvent);
|
if (component.onPointerOver) component.onPointerOver(overEvent);
|
||||||
component.onPointerEnter?.(enterEvent);
|
if (component.onPointerEnter) component.onPointerEnter(enterEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
const moveEvent = { type: 'pointermove', component, intersect };
|
const moveEvent = { type: 'pointermove', component, intersect };
|
||||||
onIntersectMove(moveEvent);
|
onIntersectMove(moveEvent);
|
||||||
component.onPointerMove?.(moveEvent);
|
if (component.onPointerMove) component.onPointerMove(moveEvent);
|
||||||
|
|
||||||
offObjects.splice(offObjects.indexOf(object), 1);
|
offObjects.splice(offObjects.indexOf(object), 1);
|
||||||
});
|
});
|
||||||
@ -103,8 +103,8 @@ export default function usePointer(options) {
|
|||||||
const leaveEvent = { ...overEvent, type: 'pointerleave' };
|
const leaveEvent = { ...overEvent, type: 'pointerleave' };
|
||||||
onIntersectOver(overEvent);
|
onIntersectOver(overEvent);
|
||||||
onIntersectLeave(leaveEvent);
|
onIntersectLeave(leaveEvent);
|
||||||
component.onPointerOver?.(overEvent);
|
if (component.onPointerOver) component.onPointerOver(overEvent);
|
||||||
component.onPointerLeave?.(leaveEvent);
|
if (component.onPointerLeave) component.onPointerLeave(leaveEvent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ export default function usePointer(options) {
|
|||||||
|
|
||||||
const event = { type: 'click', component, intersect };
|
const event = { type: 'click', component, intersect };
|
||||||
onIntersectClick(event);
|
onIntersectClick(event);
|
||||||
component.onClick?.(event);
|
if (component.onClick) component.onClick(event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user