From 6c8216bf5b097cb483f87b9f71203b8c2767c4d1 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Fri, 21 Apr 2023 15:25:53 -0700 Subject: [PATCH] robustify pointing (#4238) * robustify pointing * typo --- .../model-viewer/src/three-components/SmoothControls.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/model-viewer/src/three-components/SmoothControls.ts b/packages/model-viewer/src/three-components/SmoothControls.ts index 44d4a27c95..b15d75611c 100644 --- a/packages/model-viewer/src/three-components/SmoothControls.ts +++ b/packages/model-viewer/src/three-components/SmoothControls.ts @@ -711,6 +711,12 @@ export class SmoothControls extends EventDispatcher { return; } + // In case no one gave us a pointerup or pointercancel event. + if (event.pointerType === 'mouse' && event.buttons === 0) { + this.onPointerUp(event); + return; + } + const numTouches = this.pointers.length; const dx = (event.clientX - pointer.clientX) / numTouches; const dy = (event.clientY - pointer.clientY) / numTouches;