Skip to content

Commit

Permalink
fix: pointer move attempts to intersect geometries causing intense lag
Browse files Browse the repository at this point in the history
After adding a OrbitControls to the canvas and loading a relatively big STL file (50mb). Performance is really bad when the pointer is moving over the geometry. Using Chrome's performance diagnostics tool, I found out that happens because this library attempts to intersect the geometry the pointer is on every pointer move event. Not sure if this is the correct solution, but it cancels the intersection calculations on pointer move.
  • Loading branch information
FlafyDev authored Oct 6, 2024
1 parent 818e383 commit 574ec3e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/fiber/src/core/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ export function createEvents(store: UseBoundStore<RootState>) {
const isClickEvent = name === 'onClick' || name === 'onContextMenu' || name === 'onDoubleClick'
const filter = isPointerMove ? filterPointerEvents : undefined

const hits = intersect(event, filter)
const hits = isPointerMove ? [] : intersect(event, filter)
const delta = isClickEvent ? calculateDistance(event) : 0

// Save initial coordinates on pointer-down
Expand Down

0 comments on commit 574ec3e

Please sign in to comment.