Skip to content

Commit

Permalink
feat(OrbitControls): stopListenToKeyEvents (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett authored Aug 1, 2023
1 parent 4df2314 commit 7aa3117
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/controls/OrbitControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class OrbitControls extends EventDispatcher {
getDistance: () => number

listenToKeyEvents: (domElement: HTMLElement) => void
stopListenToKeyEvents: () => void
saveState: () => void
reset: () => void
update: () => void
Expand Down Expand Up @@ -164,6 +165,11 @@ class OrbitControls extends EventDispatcher {
this._domElementKeyEvents = domElement
}

this.stopListenToKeyEvents = (): void => {
this._domElementKeyEvents.removeEventListener('keydown', onKeyDown)
this._domElementKeyEvents = null
}

this.saveState = (): void => {
scope.target0.copy(scope.target)
scope.position0.copy(scope.object.position)
Expand Down

0 comments on commit 7aa3117

Please sign in to comment.