Skip to content

Commit

Permalink
Added pointer capture when mouse is down
Browse files Browse the repository at this point in the history
  • Loading branch information
kpal81xd committed Nov 18, 2024
1 parent bd1a03e commit 0a04b42
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scripts/camera-controls.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ class CameraControls extends Script {
if (!this._camera) {
return;
}
this._element.setPointerCapture(event.pointerId);
this._pointerEvents.set(event.pointerId, event);

const startTouchPan = this.enablePan && this._pointerEvents.size === 2;
Expand Down Expand Up @@ -562,6 +563,7 @@ class CameraControls extends Script {
* @param {PointerEvent} event - The pointer event.
*/
_onPointerUp(event) {
this._element.releasePointerCapture(event.pointerId);
this._pointerEvents.delete(event.pointerId);
if (this._pointerEvents.size < 2) {
this._lastPinchDist = -1;
Expand Down

0 comments on commit 0a04b42

Please sign in to comment.