@thatopen/components 2.0.0-alpha.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Clipper/index.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +14 -14
- package/dist/namespace.d.ts +719 -555
- package/dist/navigation/OrthoPerspectiveCamera/index.d.ts +49 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/first-person-mode.d.ts +16 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/index.d.ts +5 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/orbit-mode.d.ts +16 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/plan-mode.d.ts +20 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/projections.d.ts +37 -0
- package/dist/navigation/OrthoPerspectiveCamera/src/types.d.ts +27 -0
- package/dist/navigation/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { Components } from "../../core/Components";
|
|
3
|
+
import { SimpleCamera } from "../../core";
|
|
4
|
+
import { NavigationMode, NavModeID, ProjectionManager } from "./src";
|
|
5
|
+
export * from "./src";
|
|
6
|
+
/**
|
|
7
|
+
* A flexible camera that uses
|
|
8
|
+
* [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to
|
|
9
|
+
* easily control the camera in 2D and 3D. It supports multiple navigation
|
|
10
|
+
* modes, such as 2D floor plan navigation, first person and 3D orbit.
|
|
11
|
+
*/
|
|
12
|
+
export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
13
|
+
/**
|
|
14
|
+
* The current {@link NavigationMode}.
|
|
15
|
+
*/
|
|
16
|
+
mode: NavigationMode;
|
|
17
|
+
readonly core: ProjectionManager;
|
|
18
|
+
readonly threeOrtho: THREE.OrthographicCamera;
|
|
19
|
+
protected readonly _userInputButtons: any;
|
|
20
|
+
protected readonly _frustumSize = 50;
|
|
21
|
+
protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
|
|
22
|
+
constructor(components: Components);
|
|
23
|
+
/** {@link Disposable.dispose} */
|
|
24
|
+
dispose(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Sets a new {@link NavigationMode} and disables the previous one.
|
|
27
|
+
*
|
|
28
|
+
* @param mode - The {@link NavigationMode} to set.
|
|
29
|
+
*/
|
|
30
|
+
set(mode: NavModeID): void;
|
|
31
|
+
/**
|
|
32
|
+
* Make the camera view fit all the specified meshes.
|
|
33
|
+
*
|
|
34
|
+
* @param meshes the meshes to fit. If it is not defined, it will
|
|
35
|
+
* evaluate {@link Components.meshes}.
|
|
36
|
+
* @param offset the distance to the fit object
|
|
37
|
+
*/
|
|
38
|
+
fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Allows or prevents all user input.
|
|
41
|
+
*
|
|
42
|
+
* @param active - whether to enable or disable user inputs.
|
|
43
|
+
*/
|
|
44
|
+
setUserInput(active: boolean): void;
|
|
45
|
+
private disableUserInput;
|
|
46
|
+
private enableUserInput;
|
|
47
|
+
private newOrthoCamera;
|
|
48
|
+
private setOrthoCameraAspect;
|
|
49
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NavigationMode } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A {@link NavigationMode} that allows first person navigation,
|
|
4
|
+
* simulating FPS video games.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FirstPersonMode implements NavigationMode {
|
|
7
|
+
private camera;
|
|
8
|
+
/** {@link NavigationMode.enabled} */
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
/** {@link NavigationMode.id} */
|
|
11
|
+
readonly id = "FirstPerson";
|
|
12
|
+
constructor(camera: any);
|
|
13
|
+
/** {@link NavigationMode.set} */
|
|
14
|
+
set(active: boolean): void;
|
|
15
|
+
private setupFirstPersonCamera;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NavigationMode } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A {@link NavigationMode} that allows 3D navigation and panning
|
|
4
|
+
* like in many 3D and CAD softwares.
|
|
5
|
+
*/
|
|
6
|
+
export declare class OrbitMode implements NavigationMode {
|
|
7
|
+
camera: any;
|
|
8
|
+
/** {@link NavigationMode.enabled} */
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
/** {@link NavigationMode.id} */
|
|
11
|
+
readonly id = "Orbit";
|
|
12
|
+
constructor(camera: any);
|
|
13
|
+
/** {@link NavigationMode.set} */
|
|
14
|
+
set(active: boolean): void;
|
|
15
|
+
private activateOrbitControls;
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NavigationMode } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A {@link NavigationMode} that allows to navigate floorplans in 2D,
|
|
4
|
+
* like many BIM tools.
|
|
5
|
+
*/
|
|
6
|
+
export declare class PlanMode implements NavigationMode {
|
|
7
|
+
private camera;
|
|
8
|
+
/** {@link NavigationMode.enabled} */
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
/** {@link NavigationMode.id} */
|
|
11
|
+
readonly id = "Plan";
|
|
12
|
+
private mouseAction1?;
|
|
13
|
+
private mouseAction2?;
|
|
14
|
+
private mouseInitialized;
|
|
15
|
+
private readonly defaultAzimuthSpeed;
|
|
16
|
+
private readonly defaultPolarSpeed;
|
|
17
|
+
constructor(camera: any);
|
|
18
|
+
/** {@link NavigationMode.set} */
|
|
19
|
+
set(active: boolean): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
import { CameraProjection } from "./types";
|
|
3
|
+
import { Event } from "../../../core";
|
|
4
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
5
|
+
/**
|
|
6
|
+
* Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ProjectionManager {
|
|
9
|
+
/**
|
|
10
|
+
* Event that fires when the {@link CameraProjection} changes.
|
|
11
|
+
*/
|
|
12
|
+
readonly onProjectionChanged: Event<THREE.Camera>;
|
|
13
|
+
projection: CameraProjection;
|
|
14
|
+
three: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
15
|
+
private _component;
|
|
16
|
+
private _previousDistance;
|
|
17
|
+
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
18
|
+
matchOrthoDistanceEnabled: boolean;
|
|
19
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
20
|
+
/**
|
|
21
|
+
* Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
22
|
+
*
|
|
23
|
+
* @param projection - the new projection to set. If it is the current projection,
|
|
24
|
+
* it will have no effect.
|
|
25
|
+
*/
|
|
26
|
+
set(projection: CameraProjection): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Changes the current {@link CameraProjection} from Ortographic to Perspective
|
|
29
|
+
* and vice versa.
|
|
30
|
+
*/
|
|
31
|
+
toggle(): Promise<void>;
|
|
32
|
+
private setOrthoCamera;
|
|
33
|
+
private getDims;
|
|
34
|
+
private setupOrthoCamera;
|
|
35
|
+
private getDistance;
|
|
36
|
+
private setPerspectiveCamera;
|
|
37
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The projection system of the camera.
|
|
3
|
+
*/
|
|
4
|
+
export type CameraProjection = "Perspective" | "Orthographic";
|
|
5
|
+
/**
|
|
6
|
+
* The extensible list of supported navigation modes.
|
|
7
|
+
*/
|
|
8
|
+
export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
|
|
9
|
+
/**
|
|
10
|
+
* An object that determines the behavior of the camera controls
|
|
11
|
+
* and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
12
|
+
*/
|
|
13
|
+
export interface NavigationMode {
|
|
14
|
+
/** The unique ID of this navigation mode. */
|
|
15
|
+
id: NavModeID;
|
|
16
|
+
/**
|
|
17
|
+
* Enable or disable this navigation mode.
|
|
18
|
+
* When a new navigation mode is enabled, the previous navigation mode
|
|
19
|
+
* must be disabled.
|
|
20
|
+
*
|
|
21
|
+
* @param active - whether to enable or disable this mode.
|
|
22
|
+
* @param options - any additional data required to enable or disable it.
|
|
23
|
+
* */
|
|
24
|
+
set: (active: boolean, options?: any) => void;
|
|
25
|
+
/** Whether this navigation mode is active or not. */
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./OrthoPerspectiveCamera";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thatopen/components",
|
|
3
3
|
"description": "Collection of core functionalities to author BIM apps.",
|
|
4
|
-
"version": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.1",
|
|
5
5
|
"author": "That Open Company",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Antonio Gonzalez Viegas (https://github.com/agviegas)",
|