From 9827292f30860fa55918b4981b3f7a9f8fa364dc Mon Sep 17 00:00:00 2001 From: dcsturman Date: Thu, 13 Feb 2025 17:51:14 -0800 Subject: [PATCH] Quick bugfix to Flycontrols First, I'll 100% admit I don't fully understand this code (apologies). However, repeated bug under use of Flycontrols with dragToLook = true, that it would get "stuck" as if the mouse was always down. This happened with some condition where mouseStatus ended up > 1 and never got back to 0. This two line fix seems to fix it. Been testing it locally and works well. Feedback welcome! --- src/controls/FlyControls.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controls/FlyControls.ts b/src/controls/FlyControls.ts index 4d473bdc..1fe1bf15 100644 --- a/src/controls/FlyControls.ts +++ b/src/controls/FlyControls.ts @@ -174,7 +174,7 @@ class FlyControls extends EventDispatcher { private pointerdown = (event: MouseEvent): void => { if (this.dragToLook) { - this.mouseStatus++ + this.mouseStatus = 1 } else { switch (event.button) { case 0: @@ -204,7 +204,7 @@ class FlyControls extends EventDispatcher { private pointerup = (event: MouseEvent): void => { if (this.dragToLook) { - this.mouseStatus-- + this.mouseStatus = 0 this.moveState.yawLeft = this.moveState.pitchDown = 0 } else {