Skip to content

Commit

Permalink
robustify pointing (#4238)
Browse files Browse the repository at this point in the history
* robustify pointing

* typo
  • Loading branch information
elalish authored Apr 21, 2023
1 parent 6583b25 commit 6c8216b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/model-viewer/src/three-components/SmoothControls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6c8216b

Please sign in to comment.