From 26e0ca60633f6ca562b9cef7438488b2c0a660e5 Mon Sep 17 00:00:00 2001 From: Sander Moolin Date: Mon, 22 Mar 2021 14:57:22 -0400 Subject: [PATCH] optimize notes --- src/core/Raycaster.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/Raycaster.js b/src/core/Raycaster.js index 382f662..49d62e3 100644 --- a/src/core/Raycaster.js +++ b/src/core/Raycaster.js @@ -94,6 +94,7 @@ export default { instanceId: intersect.instanceId } }); + // TODO: optimize const newIntersects = intersects.filter(intersect => !old.find(val => val.object === intersect.object && val.instanceId === intersect.instanceId)); if (newIntersects.length) { this.onPointerEnter(newIntersects) @@ -113,6 +114,7 @@ export default { instanceId: intersect.instanceId } }); + // TODO: optimize const expiredIntersects = this._intersects.filter(intersect => !newObjects.find(val => val.object === intersect.object && val.instanceId === intersect.instanceId)); if (expiredIntersects.length) { this.onPointerLeave(expiredIntersects)