Skip to content

Commit

Permalink
fix: revert use of setPointerCapture (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsimone authored Oct 12, 2023
1 parent 35e55ad commit f58eee2
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/controls/OrbitControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,8 @@ class OrbitControls extends EventDispatcher {
scope.domElement?.removeEventListener('pointerdown', onPointerDown)
scope.domElement?.removeEventListener('pointercancel', onPointerCancel)
scope.domElement?.removeEventListener('wheel', onMouseWheel)
scope.domElement?.removeEventListener('pointermove', onPointerMove)
scope.domElement?.removeEventListener('pointerup', onPointerUp)
scope.domElement?.ownerDocument.removeEventListener('pointermove', onPointerMove)
scope.domElement?.ownerDocument.removeEventListener('pointerup', onPointerUp)
if (scope._domElementKeyEvents !== null) {
scope._domElementKeyEvents.removeEventListener('keydown', onKeyDown)
}
Expand Down Expand Up @@ -812,10 +812,8 @@ class OrbitControls extends EventDispatcher {
if (scope.enabled === false) return

if (pointers.length === 0) {
scope.domElement?.setPointerCapture(event.pointerId)

scope.domElement?.addEventListener('pointermove', onPointerMove)
scope.domElement?.addEventListener('pointerup', onPointerUp)
scope.domElement?.ownerDocument.addEventListener('pointermove', onPointerMove)
scope.domElement?.ownerDocument.addEventListener('pointerup', onPointerUp)
}

addPointer(event)
Expand Down Expand Up @@ -843,8 +841,8 @@ class OrbitControls extends EventDispatcher {
if (pointers.length === 0) {
scope.domElement?.releasePointerCapture(event.pointerId)

scope.domElement?.removeEventListener('pointermove', onPointerMove)
scope.domElement?.removeEventListener('pointerup', onPointerUp)
scope.domElement?.ownerDocument.removeEventListener('pointermove', onPointerMove)
scope.domElement?.ownerDocument.removeEventListener('pointerup', onPointerUp)
}

scope.dispatchEvent(endEvent)
Expand Down

0 comments on commit f58eee2

Please sign in to comment.