From 5c427e1ba0210a7ace282033425005b385186448 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 25 Aug 2024 12:32:43 -0400 Subject: [PATCH 1/2] FlyControls: Derive from Controls. --- .../three/examples/jsm/controls/Controls.d.ts | 2 +- .../examples/jsm/controls/FlyControls.d.ts | 35 +++++++++++++------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/types/three/examples/jsm/controls/Controls.d.ts b/types/three/examples/jsm/controls/Controls.d.ts index 5558269ea..79c72a757 100644 --- a/types/three/examples/jsm/controls/Controls.d.ts +++ b/types/three/examples/jsm/controls/Controls.d.ts @@ -48,7 +48,7 @@ declare abstract class Controls extends EventDispatcher { - constructor(object: Camera, domElement?: HTMLElement); - - autoForward: boolean; - domElement: HTMLElement | Document; - dragToLook: boolean; - enabled: boolean; +declare class FlyControls extends Controls { + /** + * The movement speed. Default is `1`. + */ movementSpeed: number; - object: Camera; + + /** + * The rotation speed. Default is `0.005`. + */ rollSpeed: number; - dispose(): void; - update(delta: number): void; + /** + * If set to `true`, you can only look around by performing a drag interaction. Default is `false`. + */ + dragToLook: boolean; + + /** + * If set to `true`, the camera automatically moves forward (and does not stop) when initially translated. Default + * is `false`. + */ + autoForward: boolean; + + constructor(object: Camera, domElement?: HTMLElement | null); } + +export { FlyControls }; From 399f37de2969c9e6a3086a3dd2107ebbf5123bb8 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 25 Aug 2024 12:36:36 -0400 Subject: [PATCH 2/2] Docs --- types/three/examples/jsm/controls/FlyControls.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/types/three/examples/jsm/controls/FlyControls.d.ts b/types/three/examples/jsm/controls/FlyControls.d.ts index a5ca83e57..8c7b3fc37 100644 --- a/types/three/examples/jsm/controls/FlyControls.d.ts +++ b/types/three/examples/jsm/controls/FlyControls.d.ts @@ -2,9 +2,16 @@ import { Camera } from "three"; import { Controls } from "./Controls.js"; export interface FlyControlsEventMap { + /** + * Fires when the camera has been transformed by the controls. + */ change: {}; } +/** + * {@link FlyControls} enables a navigation similar to fly modes in DCC tools like Blender. You can arbitrarily + * transform the camera in 3D space without any limitations (e.g. focus on a specific target). + */ declare class FlyControls extends Controls { /** * The movement speed. Default is `1`. @@ -27,6 +34,11 @@ declare class FlyControls extends Controls { */ autoForward: boolean; + /** + * Creates a new instance of {@link FlyControls}. + * @param object The camera to be controlled. + * @param domElement The HTML element used for event listeners. + */ constructor(object: Camera, domElement?: HTMLElement | null); }