From 7aa3117c92a4687133c67049c2d7502b9df8d1b5 Mon Sep 17 00:00:00 2001 From: Cody Bennett Date: Tue, 1 Aug 2023 07:58:09 -0500 Subject: [PATCH] feat(OrbitControls): stopListenToKeyEvents (#275) --- src/controls/OrbitControls.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/controls/OrbitControls.ts b/src/controls/OrbitControls.ts index ba188dc2..266399fa 100644 --- a/src/controls/OrbitControls.ts +++ b/src/controls/OrbitControls.ts @@ -92,6 +92,7 @@ class OrbitControls extends EventDispatcher { getDistance: () => number listenToKeyEvents: (domElement: HTMLElement) => void + stopListenToKeyEvents: () => void saveState: () => void reset: () => void update: () => void @@ -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)