From 13059090023523d5d96454c0bf9757f08fcfe5c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Guimmara?= Date: Tue, 7 Jan 2025 16:22:43 +0100 Subject: [PATCH] fix(controls): export controls declaration files (GlobeControls, EnvironmentControls, CameraTransitionManager) --- src/index.d.ts | 5 +++ .../controls/CameraTransitionManager.d.ts | 18 ++++++++ src/three/controls/EnvironmentControls.d.ts | 44 +++++++++++++++++++ src/three/controls/GlobeControls.d.ts | 15 +++++++ 4 files changed, 82 insertions(+) create mode 100644 src/three/controls/CameraTransitionManager.d.ts create mode 100644 src/three/controls/EnvironmentControls.d.ts create mode 100644 src/three/controls/GlobeControls.d.ts diff --git a/src/index.d.ts b/src/index.d.ts index bc6c35baa..f25e8299a 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -12,6 +12,11 @@ export { EllipsoidRegion } from './three/math/EllipsoidRegion'; export * as GeoUtils from './three/math/GeoUtils'; export * from './three/math/GeoConstants'; +// three.js controls +export { GlobeControls } from './three/controls/GlobeControls'; +export { EnvironmentControls } from './three/controls/EnvironmentControls'; +export { CameraTransitionManager } from './three/controls/CameraTransitionManager'; + // common export { TilesRendererBase } from './base/TilesRendererBase'; export { Tile } from './base/Tile'; diff --git a/src/three/controls/CameraTransitionManager.d.ts b/src/three/controls/CameraTransitionManager.d.ts new file mode 100644 index 000000000..22321319b --- /dev/null +++ b/src/three/controls/CameraTransitionManager.d.ts @@ -0,0 +1,18 @@ +import { EventDispatcher, OrthographicCamera, PerspectiveCamera } from 'three'; + +export class CameraTransitionManager extends EventDispatcher { + + get animating(): boolean; + get camera(): PerspectiveCamera | OrthographicCamera; + + get mode(): 'perspective' | 'orthographic'; + set mode( v: 'perspective' | 'orthographic' ); + + constructor( perspectiveCamera?: PerspectiveCamera, orthographicCamera?: OrthographicCamera ); + + toggle(): void; + update(): void; + + syncCameras(): void; + +} diff --git a/src/three/controls/EnvironmentControls.d.ts b/src/three/controls/EnvironmentControls.d.ts new file mode 100644 index 000000000..173f4fa9b --- /dev/null +++ b/src/three/controls/EnvironmentControls.d.ts @@ -0,0 +1,44 @@ +import { Camera, EventDispatcher, Object3D, Vector3 } from 'three'; +import { TilesRenderer } from '../TilesRenderer'; + +export interface EnvironmentControlsEventMap { + 'change': {}; + 'start': {}; + 'end': {}; +} + +export class EnvironmentControls extends EventDispatcher { + + readonly isEnvironmentControls: true; + + get enabled(): boolean; + set enabled( v: boolean ); + + constructor( + scene?: Object3D, + camera?: Camera, + domElement?: HTMLElement, + tilesRenderer?: TilesRenderer, + ); + + setScene ( scene: Object3D ): void; + setCamera ( camera: Camera ): void; + setTilesRenderer( tilesRenderer: TilesRenderer ): void; + + attach( domElement: HTMLElement ): void; + detach(): void; + + setState( state?: number, fireEvent?: boolean ): void; + resetState(): void; + + update( deltaTime?: number ): void; + + adjustCamera( camera: Camera ): void; + + getUpDirection( point: Vector3, target: Vector3 ): void; + getCameraUpDirection( target: Vector3 ): void; + getPivotPoint ( target: Vector3 ): void; + + dispose(): void; + +} diff --git a/src/three/controls/GlobeControls.d.ts b/src/three/controls/GlobeControls.d.ts new file mode 100644 index 000000000..3863b1ba5 --- /dev/null +++ b/src/three/controls/GlobeControls.d.ts @@ -0,0 +1,15 @@ +import { Group, Vector3 } from 'three'; +import { Ellipsoid } from '../math/Ellipsoid'; +import { EnvironmentControls } from './EnvironmentControls'; + +export class GlobeControls extends EnvironmentControls { + + readonly isGlobeControls: true; + + get ellipsoid(): Ellipsoid; + get tilesGroup(): Group; + + getVectorToCenter( target: Vector3 ): Vector3; + getDistanceToCenter(): number; + +}