From eab0d02ca9444ae502a41c68dc495c399ace7d43 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Fri, 21 Apr 2023 15:06:06 -0700 Subject: [PATCH 1/2] robustify pointing --- .../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..e32a9854cc 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; From 2c92fe1e95085e5ccd5a9eda67730fd4f71e00ac Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Fri, 21 Apr 2023 15:11:11 -0700 Subject: [PATCH 2/2] typo --- packages/model-viewer/src/three-components/SmoothControls.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/model-viewer/src/three-components/SmoothControls.ts b/packages/model-viewer/src/three-components/SmoothControls.ts index e32a9854cc..b15d75611c 100644 --- a/packages/model-viewer/src/three-components/SmoothControls.ts +++ b/packages/model-viewer/src/three-components/SmoothControls.ts @@ -712,7 +712,7 @@ export class SmoothControls extends EventDispatcher { } // In case no one gave us a pointerup or pointercancel event. - if (event.pointerType == 'mouse' && event.buttons === 0) { + if (event.pointerType === 'mouse' && event.buttons === 0) { this.onPointerUp(event); return; }