@cognite/reveal 4.9.1 → 4.10.0
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/api-entry-points/core.d.ts +1 -1
- package/dist/index.js +134 -106
- package/dist/index.js.map +1 -1
- package/dist/packages/api/src/public/migration/Cognite3DViewer.d.ts +1 -1
- package/dist/packages/api/src/public/migration/types.d.ts +5 -0
- package/dist/packages/camera-manager/index.d.ts +8 -0
- package/dist/packages/camera-manager/src/CameraControlsOptions.d.ts +35 -0
- package/dist/packages/camera-manager/src/CameraManager.d.ts +4 -4
- package/dist/packages/camera-manager/src/CameraManagerHelper.d.ts +9 -9
- package/dist/packages/camera-manager/src/DefaultCameraManager.d.ts +3 -2
- package/dist/packages/camera-manager/src/Flexible/DampedSpherical.d.ts +23 -0
- package/dist/packages/camera-manager/src/Flexible/DampedVector3.d.ts +25 -0
- package/dist/packages/camera-manager/src/Flexible/FlexibleCameraManager.d.ts +81 -0
- package/dist/packages/camera-manager/src/Flexible/FlexibleCameraMarkers.d.ts +11 -0
- package/dist/packages/camera-manager/src/Flexible/FlexibleControls.d.ts +80 -0
- package/dist/packages/camera-manager/src/Flexible/FlexibleControlsEvent.d.ts +19 -0
- package/dist/packages/camera-manager/src/Flexible/FlexibleControlsOptions.d.ts +56 -0
- package/dist/packages/camera-manager/src/Flexible/FlexibleControlsType.d.ts +11 -0
- package/dist/packages/camera-manager/src/Flexible/FlexibleMouseActionType.d.ts +12 -0
- package/dist/packages/camera-manager/src/Flexible/FlexibleWheelZoomType.d.ts +24 -0
- package/dist/packages/camera-manager/src/Flexible/IFlexibleCameraManager.d.ts +20 -0
- package/dist/packages/camera-manager/src/Flexible/ReusableVector3s.d.ts +10 -0
- package/dist/packages/camera-manager/src/Flexible/moveCamera.d.ts +7 -0
- package/dist/packages/camera-manager/src/ProxyCameraManager.d.ts +4 -4
- package/dist/packages/camera-manager/src/StationaryCameraManager.d.ts +6 -6
- package/dist/packages/camera-manager/src/types.d.ts +3 -32
- package/dist/packages/tools/src/HtmlOverlay/BucketGrid2D.d.ts +5 -8
- package/dist/packages/utilities/src/three/fitCameraToBoundingBox.d.ts +2 -2
- package/package.json +6 -6
|
@@ -279,7 +279,7 @@ export declare class Cognite3DViewer {
|
|
|
279
279
|
* @param datasource The data data source which holds the references to the 360 image sets.
|
|
280
280
|
* @param dataModelIdentifier The search parameters to apply when querying Cognite Datamodels that contains the 360 images.
|
|
281
281
|
*/
|
|
282
|
-
add360ImageSet(datasource: 'datamodels', dataModelIdentifier: Image360DataModelIdentifier): Promise<Image360Collection>;
|
|
282
|
+
add360ImageSet(datasource: 'datamodels', dataModelIdentifier: Image360DataModelIdentifier, add360ImageOptions?: AddImage360Options): Promise<Image360Collection>;
|
|
283
283
|
/**
|
|
284
284
|
* Adds a set of 360 images to the scene from the /events API in Cognite Data Fusion.
|
|
285
285
|
* @param datasource The CDF data source which holds the references to the 360 image sets.
|
|
@@ -144,6 +144,11 @@ export interface Cognite3DViewerOptions {
|
|
|
144
144
|
* Default value is set to true.
|
|
145
145
|
*/
|
|
146
146
|
continuousModelStreaming?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Use the new the new flexiable camera manager or not, default not to be used.
|
|
149
|
+
* @beta
|
|
150
|
+
*/
|
|
151
|
+
useFlexibleCameraManager?: boolean;
|
|
147
152
|
}
|
|
148
153
|
/**
|
|
149
154
|
* @module @cognite/reveal
|
|
@@ -8,5 +8,13 @@ export { CameraManagerHelper } from './src/CameraManagerHelper';
|
|
|
8
8
|
export { CameraManager } from './src/CameraManager';
|
|
9
9
|
export { ComboControls, ComboControlsEventType } from './src/ComboControls';
|
|
10
10
|
export { ComboControlsOptions } from './src/ComboControlsOptions';
|
|
11
|
+
export { CameraControlsOptions } from './src/CameraControlsOptions';
|
|
11
12
|
export { DebouncedCameraStopEventTrigger } from './src/utils/DebouncedCameraStopEventTrigger';
|
|
13
|
+
export { IFlexibleCameraManager } from './src/Flexible/IFlexibleCameraManager';
|
|
14
|
+
export { FlexibleControlsTypeChangeDelegate } from './src/Flexible/IFlexibleCameraManager';
|
|
15
|
+
export { FlexibleCameraManager } from './src/Flexible/FlexibleCameraManager';
|
|
16
|
+
export { FlexibleControlsOptions } from './src/Flexible/FlexibleControlsOptions';
|
|
17
|
+
export { FlexibleWheelZoomType } from './src/Flexible/FlexibleWheelZoomType';
|
|
18
|
+
export { FlexibleControlsType } from './src/Flexible/FlexibleControlsType';
|
|
19
|
+
export { FlexibleMouseActionType } from './src/Flexible/FlexibleMouseActionType';
|
|
12
20
|
export * from './src/types';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
export type CameraControlsOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Sets mouse wheel initiated action.
|
|
7
|
+
*
|
|
8
|
+
* Modes:
|
|
9
|
+
*
|
|
10
|
+
* 'zoomToTarget' - zooms just to the current target (center of the screen) of the camera.
|
|
11
|
+
*
|
|
12
|
+
* 'zoomPastCursor' - zooms in the direction of the ray coming from camera through cursor screen position, allows going through objects.
|
|
13
|
+
*
|
|
14
|
+
* 'zoomToCursor' - mouse wheel scroll zooms towards the point on the model where cursor is hovering over, doesn't allow going through objects.
|
|
15
|
+
*
|
|
16
|
+
* Default is 'zoomPastCursor'.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
mouseWheelAction?: 'zoomToTarget' | 'zoomPastCursor' | 'zoomToCursor';
|
|
20
|
+
/**
|
|
21
|
+
* Enables or disables change of camera target on mouse click. New target is then set to the point of the model under current cursor position.
|
|
22
|
+
*
|
|
23
|
+
* Default is false.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
changeCameraTargetOnClick?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Enables or disables change of camera position on mouse doubke click. New target is then set to the point of the model under current cursor
|
|
29
|
+
* position and the a camera position is set half way to this point
|
|
30
|
+
*
|
|
31
|
+
* Default is false.
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
changeCameraPositionOnDoubleClick?: boolean;
|
|
35
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import { Box3, PerspectiveCamera } from 'three';
|
|
5
5
|
import { CameraState, CameraChangeDelegate, CameraStopDelegate, CameraManagerEventType, CameraEventDelegate } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* Interface for manager responsible for all manipulations to the camera,
|
|
@@ -17,7 +17,7 @@ export interface CameraManager {
|
|
|
17
17
|
* Implementations must trigger the `cameraChange`-event whenever the
|
|
18
18
|
* camera changes.
|
|
19
19
|
*/
|
|
20
|
-
getCamera():
|
|
20
|
+
getCamera(): PerspectiveCamera;
|
|
21
21
|
/**
|
|
22
22
|
* Set camera's state. Rotation and target can't be set at the same time as they could conflict,
|
|
23
23
|
* should throw an error if both are passed with non-zero value inside state.
|
|
@@ -79,7 +79,7 @@ export interface CameraManager {
|
|
|
79
79
|
* @param duration The duration of the animation moving the camera.
|
|
80
80
|
* @param radiusFactor The ratio of the distance from camera to center of box and radius of the box.
|
|
81
81
|
*/
|
|
82
|
-
fitCameraToBoundingBox(boundingBox:
|
|
82
|
+
fitCameraToBoundingBox(boundingBox: Box3, duration?: number, radiusFactor?: number): void;
|
|
83
83
|
/**
|
|
84
84
|
* Updates internal state of camera manager. Expected to update visual state of the camera
|
|
85
85
|
* as well as it's near and far planes if needed. Called in `requestAnimationFrame`-loop.
|
|
@@ -87,7 +87,7 @@ export interface CameraManager {
|
|
|
87
87
|
* @param deltaTime Delta time since last update in seconds.
|
|
88
88
|
* @param boundingBox Global bounding box of the model(s) and any custom objects added to the scene.
|
|
89
89
|
*/
|
|
90
|
-
update(deltaTime: number, boundingBox:
|
|
90
|
+
update(deltaTime: number, boundingBox: Box3): void;
|
|
91
91
|
/**
|
|
92
92
|
* @obvious
|
|
93
93
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import { Box3, PerspectiveCamera, Quaternion, Vector3 } from 'three';
|
|
5
5
|
/**
|
|
6
6
|
* Helper methods for implementing a camera manager.
|
|
7
7
|
*/
|
|
@@ -19,30 +19,30 @@ export declare class CameraManagerHelper {
|
|
|
19
19
|
* @param position New camera position.
|
|
20
20
|
* @returns
|
|
21
21
|
*/
|
|
22
|
-
static calculateNewTargetFromRotation(camera:
|
|
22
|
+
static calculateNewTargetFromRotation(camera: PerspectiveCamera, rotation: Quaternion, currentTarget: Vector3, position: Vector3): Vector3;
|
|
23
23
|
/**
|
|
24
24
|
* Calculates camera rotation from target
|
|
25
25
|
* @param camera Used Camera instance
|
|
26
26
|
* @param newTarget The target to compute rotation from
|
|
27
27
|
* @returns New camera rotationg
|
|
28
28
|
*/
|
|
29
|
-
static calculateNewRotationFromTarget(camera:
|
|
29
|
+
static calculateNewRotationFromTarget(camera: PerspectiveCamera, newTarget: Vector3): Quaternion;
|
|
30
30
|
/**
|
|
31
31
|
* Updates near and far plane of the camera based on the bounding box.
|
|
32
32
|
* @param camera Used camera instance.
|
|
33
|
-
* @param
|
|
33
|
+
* @param boundingBox Bounding box of all objects on the scene.
|
|
34
34
|
*/
|
|
35
|
-
static updateCameraNearAndFar(camera:
|
|
35
|
+
static updateCameraNearAndFar(camera: PerspectiveCamera, boundingBox: Box3): void;
|
|
36
36
|
/**
|
|
37
37
|
* Calculates camera position and target that allows to see the content of provided bounding box.
|
|
38
38
|
* @param camera Used camera instance.
|
|
39
|
-
* @param
|
|
39
|
+
* @param boundingBox Bounding box to be fitted.
|
|
40
40
|
* @param radiusFactor The ratio of the distance from camera to center of box and radius of the box.
|
|
41
41
|
* @returns
|
|
42
42
|
*/
|
|
43
|
-
static calculateCameraStateToFitBoundingBox(camera:
|
|
44
|
-
position:
|
|
45
|
-
target:
|
|
43
|
+
static calculateCameraStateToFitBoundingBox(camera: PerspectiveCamera, boundingBox: Box3, radiusFactor?: number): {
|
|
44
|
+
position: Vector3;
|
|
45
|
+
target: Vector3;
|
|
46
46
|
};
|
|
47
47
|
private static calculateCameraFar;
|
|
48
48
|
private static calculateCameraNear;
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as THREE from 'three';
|
|
5
5
|
import { ComboControlsOptions } from './ComboControlsOptions';
|
|
6
|
-
import {
|
|
6
|
+
import { CameraState, CameraManagerEventType, CameraEventDelegate } from './types';
|
|
7
7
|
import { CameraManager } from './CameraManager';
|
|
8
|
+
import { CameraControlsOptions } from './CameraControlsOptions';
|
|
8
9
|
/**
|
|
9
10
|
* Default implementation of {@link CameraManager}. Uses target-based orbit controls combined with
|
|
10
11
|
* keyboard and mouse navigation possibility. Supports automatic update of camera near and far
|
|
@@ -23,8 +24,8 @@ export declare class DefaultCameraManager implements CameraManager {
|
|
|
23
24
|
private _isEnabled;
|
|
24
25
|
private readonly _modelRaycastCallback;
|
|
25
26
|
private _onClick;
|
|
26
|
-
private _onWheel;
|
|
27
27
|
private _onDoubleClick;
|
|
28
|
+
private _onWheel;
|
|
28
29
|
private static readonly AnimationDuration;
|
|
29
30
|
private static readonly MinAnimationDuration;
|
|
30
31
|
private static readonly MaxAnimationDuration;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Spherical, Vector3 } from 'three';
|
|
5
|
+
export declare class DampedSpherical {
|
|
6
|
+
readonly value: Spherical;
|
|
7
|
+
readonly end: Spherical;
|
|
8
|
+
private readonly _valueVector;
|
|
9
|
+
private readonly _endVector;
|
|
10
|
+
static isVertical(vector: Vector3): boolean;
|
|
11
|
+
isChanged(epsilon: number): boolean;
|
|
12
|
+
getValueVector(): Vector3;
|
|
13
|
+
getEndVector(): Vector3;
|
|
14
|
+
setValueVector(vector: Vector3): void;
|
|
15
|
+
setEndVector(vector: Vector3): void;
|
|
16
|
+
setThetaFromVector(vector: Vector3): void;
|
|
17
|
+
copy(vector: Vector3): void;
|
|
18
|
+
synchronize(): void;
|
|
19
|
+
synchronizeEnd(): void;
|
|
20
|
+
damp(dampeningFactor: number): void;
|
|
21
|
+
static correctPhi(value: Spherical): void;
|
|
22
|
+
static dampSphericalVectors(value: Spherical, end: Spherical, dampeningFactor: number): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Vector3 } from 'three';
|
|
5
|
+
export declare class DampedVector3 {
|
|
6
|
+
readonly value: Vector3;
|
|
7
|
+
readonly end: Vector3;
|
|
8
|
+
private readonly _valueVector;
|
|
9
|
+
private readonly _endVector;
|
|
10
|
+
private readonly _valueSpherical;
|
|
11
|
+
private readonly _endSpherical;
|
|
12
|
+
isChanged(epsilon: number): boolean;
|
|
13
|
+
clear(): void;
|
|
14
|
+
copy(value: Vector3): void;
|
|
15
|
+
add(other: DampedVector3): void;
|
|
16
|
+
synchronize(): void;
|
|
17
|
+
synchronizeEnd(): void;
|
|
18
|
+
damp(dampeningFactor: number): void;
|
|
19
|
+
/**
|
|
20
|
+
* Suppose this(DampedVector3) is the position that orbits around the center point (DampedVector3). This has to be damped as a vector
|
|
21
|
+
* instead of a point. It is used when the camera is orbiting around a center point.
|
|
22
|
+
* This function also damp the center, since it is dependend on the center damped position
|
|
23
|
+
* **/
|
|
24
|
+
dampAsVectorAndCenter(dampeningFactor: number, center: DampedVector3): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Box3, PerspectiveCamera, Vector3, Scene } from 'three';
|
|
5
|
+
import { FlexibleControls } from './FlexibleControls';
|
|
6
|
+
import { FlexibleControlsOptions } from './FlexibleControlsOptions';
|
|
7
|
+
import { InputHandler } from '../../../utilities';
|
|
8
|
+
import { CameraEventDelegate, CameraManagerCallbackData, CameraManagerEventType, CameraState } from './../types';
|
|
9
|
+
import { CameraManager } from './../CameraManager';
|
|
10
|
+
import { FlexibleControlsType } from './FlexibleControlsType';
|
|
11
|
+
import { FlexibleControlsTypeChangeDelegate, IFlexibleCameraManager } from './IFlexibleCameraManager';
|
|
12
|
+
type RaycastCallback = (x: number, y: number, pickBoundingBox: boolean) => Promise<CameraManagerCallbackData>;
|
|
13
|
+
/**
|
|
14
|
+
* Flexible implementation of {@link CameraManager}. The user can switch between Orbit, FirstPersion or OrbitInCenter
|
|
15
|
+
* Supports automatic update of camera near and far planes and animated change of camera position and target.
|
|
16
|
+
* @beta
|
|
17
|
+
*/
|
|
18
|
+
export declare class FlexibleCameraManager implements IFlexibleCameraManager {
|
|
19
|
+
private readonly _triggers;
|
|
20
|
+
private readonly _stopEventTrigger;
|
|
21
|
+
private readonly _controls;
|
|
22
|
+
private readonly _camera;
|
|
23
|
+
private readonly _domElement;
|
|
24
|
+
private readonly _inputHandler;
|
|
25
|
+
private readonly _markers?;
|
|
26
|
+
private readonly _currentBoundingBox;
|
|
27
|
+
private _isDisposed;
|
|
28
|
+
private _nearAndFarNeedsUpdate;
|
|
29
|
+
private _isEnabled;
|
|
30
|
+
private _prevTime;
|
|
31
|
+
private readonly _prevCoords;
|
|
32
|
+
private readonly _raycastCallback;
|
|
33
|
+
constructor(domElement: HTMLElement, inputHandler: InputHandler, raycastCallback: RaycastCallback, camera?: PerspectiveCamera, scene?: Scene);
|
|
34
|
+
getCamera(): PerspectiveCamera;
|
|
35
|
+
getCameraState(): Required<CameraState>;
|
|
36
|
+
/**
|
|
37
|
+
* Sets camera state. All parameters are optional. Rotation and target can't be set at the same time,
|
|
38
|
+
* if so, error will be thrown. Set rotation is preserved until next call of setCameraState with
|
|
39
|
+
* empty rotation field.
|
|
40
|
+
* @param state Camera state.
|
|
41
|
+
* **/
|
|
42
|
+
setCameraState(state: CameraState): void;
|
|
43
|
+
activate(cameraManager?: CameraManager): void;
|
|
44
|
+
deactivate(): void;
|
|
45
|
+
on(event: CameraManagerEventType, callback: CameraEventDelegate): void;
|
|
46
|
+
off(event: CameraManagerEventType, callback: CameraEventDelegate): void;
|
|
47
|
+
fitCameraToBoundingBox(boundingBox: Box3, duration?: number, radiusFactor?: number): void;
|
|
48
|
+
update(deltaTime: number, boundingBox: Box3): void;
|
|
49
|
+
dispose(): void;
|
|
50
|
+
get controlsType(): FlexibleControlsType;
|
|
51
|
+
set controlsType(value: FlexibleControlsType);
|
|
52
|
+
addControlsTypeChangeListener(callback: FlexibleControlsTypeChangeDelegate): void;
|
|
53
|
+
removeControlsTypeChangeListener(callback: FlexibleControlsTypeChangeDelegate): void;
|
|
54
|
+
get options(): FlexibleControlsOptions;
|
|
55
|
+
get controls(): FlexibleControls;
|
|
56
|
+
get camera(): PerspectiveCamera;
|
|
57
|
+
get domElement(): HTMLElement;
|
|
58
|
+
get isEnabled(): boolean;
|
|
59
|
+
get isDisposed(): boolean;
|
|
60
|
+
private set isEnabled(value);
|
|
61
|
+
private getPosition;
|
|
62
|
+
private getTarget;
|
|
63
|
+
getBoundingBoxDiagonal(): number;
|
|
64
|
+
getHorizontalDiagonal(): number;
|
|
65
|
+
setPositionAndTarget(position: Vector3, target: Vector3): void;
|
|
66
|
+
private getPickedPointPixelCoordinates;
|
|
67
|
+
private getTargetByBoundingBox;
|
|
68
|
+
private addEventListeners;
|
|
69
|
+
private removeEventListeners;
|
|
70
|
+
private readonly onCameraChange;
|
|
71
|
+
private readonly onControlsTypeChange;
|
|
72
|
+
private readonly onKeyDown;
|
|
73
|
+
private readonly onClick;
|
|
74
|
+
private readonly onDoubleClick;
|
|
75
|
+
private readonly onWheel;
|
|
76
|
+
private mouseAction;
|
|
77
|
+
private setTargetAndCameraPosition;
|
|
78
|
+
private updateCameraNearAndFar;
|
|
79
|
+
private updateControlsSensitivity;
|
|
80
|
+
}
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Scene } from 'three';
|
|
5
|
+
import { FlexibleCameraManager } from './FlexibleCameraManager';
|
|
6
|
+
export declare class FlexibleCameraMarkers {
|
|
7
|
+
private readonly _scene;
|
|
8
|
+
private _targetMarker;
|
|
9
|
+
constructor(scene: Scene);
|
|
10
|
+
update(manager: FlexibleCameraManager): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { EventDispatcher, OrthographicCamera, PerspectiveCamera, Quaternion, Vector3 } from 'three';
|
|
5
|
+
import { FlexibleControlsType } from './FlexibleControlsType';
|
|
6
|
+
import { FlexibleControlsOptions } from './FlexibleControlsOptions';
|
|
7
|
+
import { FlexibleControlsEvent } from './FlexibleControlsEvent';
|
|
8
|
+
/**
|
|
9
|
+
* @beta
|
|
10
|
+
*/
|
|
11
|
+
export declare class FlexibleControls extends EventDispatcher<FlexibleControlsEvent> {
|
|
12
|
+
private _isEnabled;
|
|
13
|
+
temporarlyDisableKeyboard: boolean;
|
|
14
|
+
private readonly _options;
|
|
15
|
+
private readonly _domElement;
|
|
16
|
+
private readonly _camera;
|
|
17
|
+
private readonly _target;
|
|
18
|
+
private readonly _cameraPosition;
|
|
19
|
+
private readonly _cameraVector;
|
|
20
|
+
private _scrollDirection;
|
|
21
|
+
private _scrollDistance;
|
|
22
|
+
private _tempTarget;
|
|
23
|
+
private readonly _keyboard;
|
|
24
|
+
private readonly _pointEventCache;
|
|
25
|
+
private readonly _reusableVector3s;
|
|
26
|
+
constructor(camera: PerspectiveCamera | OrthographicCamera, domElement: HTMLElement, options: FlexibleControlsOptions);
|
|
27
|
+
dispose(): void;
|
|
28
|
+
get options(): FlexibleControlsOptions;
|
|
29
|
+
get isEnabled(): boolean;
|
|
30
|
+
set isEnabled(isEnabled: boolean);
|
|
31
|
+
get controlsType(): FlexibleControlsType;
|
|
32
|
+
getTarget(): Vector3;
|
|
33
|
+
setTarget(value: Vector3): void;
|
|
34
|
+
getLookAt(): Vector3;
|
|
35
|
+
getState(): {
|
|
36
|
+
target: Vector3;
|
|
37
|
+
position: Vector3;
|
|
38
|
+
};
|
|
39
|
+
setScrollCursor(value: Vector3 | undefined): void;
|
|
40
|
+
setTempTarget(value: Vector3 | undefined): void;
|
|
41
|
+
setPositionAndTarget(position: Vector3, target: Vector3): void;
|
|
42
|
+
setPositionAndDirection(position: Vector3, direction: Vector3): void;
|
|
43
|
+
setPositionAndRotation(position: Vector3, rotation: Quaternion): void;
|
|
44
|
+
setControlsType(controlsType: FlexibleControlsType): boolean;
|
|
45
|
+
private getPanFactor;
|
|
46
|
+
private getWheelSpeed;
|
|
47
|
+
private getDampingFactor;
|
|
48
|
+
private newVector3;
|
|
49
|
+
update(deltaTimeS: number, forceUpdate?: boolean): boolean;
|
|
50
|
+
triggerCameraChangeEvent(): void;
|
|
51
|
+
triggerControlsTypeChangeEvent(): void;
|
|
52
|
+
private readonly onPointerDown;
|
|
53
|
+
private readonly onMouseDown;
|
|
54
|
+
private readonly onPointerUp;
|
|
55
|
+
private readonly onMouseWheel;
|
|
56
|
+
private readonly onTouchStart;
|
|
57
|
+
private readonly onFocusChanged;
|
|
58
|
+
private readonly onContextMenu;
|
|
59
|
+
addEventListeners(): void;
|
|
60
|
+
private removeEventListeners;
|
|
61
|
+
private startMouseRotation;
|
|
62
|
+
private startTouchRotation;
|
|
63
|
+
private rotate;
|
|
64
|
+
private getAzimuthCompensationFactor;
|
|
65
|
+
private rotateByAngles;
|
|
66
|
+
private rawRotateByAngles;
|
|
67
|
+
private startTouchPinch;
|
|
68
|
+
private startMousePan;
|
|
69
|
+
private pan;
|
|
70
|
+
private translate;
|
|
71
|
+
private dollyOrthographicCamera;
|
|
72
|
+
private dollyWithWheelScroll;
|
|
73
|
+
private getTranslation;
|
|
74
|
+
private getTranslationByDirection;
|
|
75
|
+
private getTranslationByScrollCursor;
|
|
76
|
+
private getStep;
|
|
77
|
+
private handleKeyboard;
|
|
78
|
+
private handleRotationFromKeyboard;
|
|
79
|
+
private handleMoveFromKeyboard;
|
|
80
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Vector3 } from 'three';
|
|
5
|
+
import { FlexibleControlsType } from './FlexibleControlsType';
|
|
6
|
+
/**
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
export type FlexibleControlsEvent = {
|
|
10
|
+
cameraChange: {
|
|
11
|
+
content: {
|
|
12
|
+
position: Vector3;
|
|
13
|
+
target: Vector3;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
controlsTypeChange: {
|
|
17
|
+
controlsType: FlexibleControlsType;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { FlexibleControlsType } from './FlexibleControlsType';
|
|
5
|
+
import { FlexibleMouseActionType } from './FlexibleMouseActionType';
|
|
6
|
+
import { FlexibleWheelZoomType } from './FlexibleWheelZoomType';
|
|
7
|
+
/**
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export declare class FlexibleControlsOptions {
|
|
11
|
+
controlsType: FlexibleControlsType;
|
|
12
|
+
showTarget: boolean;
|
|
13
|
+
mouseWheelAction: FlexibleWheelZoomType;
|
|
14
|
+
mouseClickType: FlexibleMouseActionType;
|
|
15
|
+
mouseDoubleClickType: FlexibleMouseActionType;
|
|
16
|
+
enableChangeControlsTypeOn123Key: boolean;
|
|
17
|
+
enableKeyboardNavigation: boolean;
|
|
18
|
+
animationDuration: number;
|
|
19
|
+
minimumTimeBetweenRaycasts: number;
|
|
20
|
+
maximumTimeBetweenRaycasts: number;
|
|
21
|
+
mouseDistanceThresholdBetweenRaycasts: number;
|
|
22
|
+
minPolarAngle: number;
|
|
23
|
+
maxPolarAngle: number;
|
|
24
|
+
minAzimuthAngle: number;
|
|
25
|
+
maxAzimuthAngle: number;
|
|
26
|
+
enableDamping: boolean;
|
|
27
|
+
dampingFactor: number;
|
|
28
|
+
automaticNearFarPlane: boolean;
|
|
29
|
+
sensitivity: number;
|
|
30
|
+
automaticSensitivity: boolean;
|
|
31
|
+
sensitivityDiagonalFraction: number;
|
|
32
|
+
minSensitivity: number;
|
|
33
|
+
maxSensitivity: number;
|
|
34
|
+
mouseRotationSpeedAzimuth: number;
|
|
35
|
+
mouseRotationSpeedPolar: number;
|
|
36
|
+
keyboardRotationSpeedAzimuth: number;
|
|
37
|
+
keyboardRotationSpeedPolar: number;
|
|
38
|
+
zoomFraction: number;
|
|
39
|
+
minOrthographicZoom: number;
|
|
40
|
+
maxOrthographicZoom: number;
|
|
41
|
+
wheelDollySpeed: number;
|
|
42
|
+
mousePanSpeed: number;
|
|
43
|
+
mouseDollySpeed: number;
|
|
44
|
+
keyboardPanSpeed: number;
|
|
45
|
+
keyboardDollySpeed: number;
|
|
46
|
+
keyboardFastMoveFactor: number;
|
|
47
|
+
pinchEpsilon: number;
|
|
48
|
+
pinchPanSpeed: number;
|
|
49
|
+
EPSILON: number;
|
|
50
|
+
orthographicCameraDollyFactor: number;
|
|
51
|
+
get realMouseWheelAction(): FlexibleWheelZoomType;
|
|
52
|
+
get shouldPick(): boolean;
|
|
53
|
+
getLegalAzimuthAngle(azimuthAngle: number): number;
|
|
54
|
+
getLegalPolarAngle(polarAngle: number): number;
|
|
55
|
+
getLegalSensitivity(controlsSensitivity: number): number;
|
|
56
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @beta
|
|
6
|
+
*/
|
|
7
|
+
export declare enum FlexibleMouseActionType {
|
|
8
|
+
None = "none",
|
|
9
|
+
SetTarget = "setTarget",
|
|
10
|
+
SetTargetAndCameraDirection = "setTargetAndCameraDirection",
|
|
11
|
+
SetTargetAndCameraPosition = "setTargetAndCameraPosition"
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Sets mouse wheel initiated action.
|
|
6
|
+
*
|
|
7
|
+
* Modes:
|
|
8
|
+
*
|
|
9
|
+
* 'ToTarget' - zooms just to the current target (center of the screen) of the camera.
|
|
10
|
+
*
|
|
11
|
+
* 'PastCursor' - zooms in the direction of the ray coming from camera through cursor screen position, allows going through objects.
|
|
12
|
+
*
|
|
13
|
+
* 'ToCursor' - mouse wheel scroll zooms towards the point on the model where cursor is hovering over, doesn't allow going through objects.
|
|
14
|
+
*
|
|
15
|
+
* Default is 'zoomPastCursor'.
|
|
16
|
+
*
|
|
17
|
+
* @beta
|
|
18
|
+
*/
|
|
19
|
+
export declare enum FlexibleWheelZoomType {
|
|
20
|
+
Center = "center",
|
|
21
|
+
PastCursor = "pastCursor",
|
|
22
|
+
ToCursor = "toCursor",
|
|
23
|
+
Auto = "auto"
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { CameraManager } from '../CameraManager';
|
|
5
|
+
import { FlexibleControlsType } from './FlexibleControlsType';
|
|
6
|
+
/**
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
export type FlexibleControlsTypeChangeDelegate = (controlsType: FlexibleControlsType) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Flexible implementation of {@link CameraManager}. The user can switch between Orbit, FirstPersion or OrbitInCenter
|
|
12
|
+
* Supports automatic update of camera near and far planes and animated change of camera position and target.
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export interface IFlexibleCameraManager extends CameraManager {
|
|
16
|
+
get controlsType(): FlexibleControlsType;
|
|
17
|
+
set controlsType(value: FlexibleControlsType);
|
|
18
|
+
addControlsTypeChangeListener(callback: FlexibleControlsTypeChangeDelegate): void;
|
|
19
|
+
removeControlsTypeChangeListener(callback: FlexibleControlsTypeChangeDelegate): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 Cognite AS
|
|
3
|
+
*/
|
|
4
|
+
import { Vector3 } from 'three';
|
|
5
|
+
import { FlexibleCameraManager } from './FlexibleCameraManager';
|
|
6
|
+
export declare function moveCameraTo(manager: FlexibleCameraManager, position: Vector3, target: Vector3, duration?: number): void;
|
|
7
|
+
export declare function moveCameraTargetTo(manager: FlexibleCameraManager, target: Vector3, duration?: number): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import { Box3, PerspectiveCamera } from 'three';
|
|
5
5
|
import { CameraManager } from './CameraManager';
|
|
6
6
|
import { CameraChangeDelegate, CameraState, CameraStopDelegate } from './types';
|
|
7
7
|
export declare class ProxyCameraManager implements CameraManager {
|
|
@@ -11,7 +11,7 @@ export declare class ProxyCameraManager implements CameraManager {
|
|
|
11
11
|
get innerCameraManager(): CameraManager;
|
|
12
12
|
constructor(initialActiveCamera: CameraManager);
|
|
13
13
|
setActiveCameraManager(cameraManager: CameraManager): void;
|
|
14
|
-
getCamera():
|
|
14
|
+
getCamera(): PerspectiveCamera;
|
|
15
15
|
setCameraState(state: CameraState): void;
|
|
16
16
|
getCameraState(): Required<CameraState>;
|
|
17
17
|
activate(cameraManager?: CameraManager): void;
|
|
@@ -20,8 +20,8 @@ export declare class ProxyCameraManager implements CameraManager {
|
|
|
20
20
|
on(eventType: 'cameraStop', callback: CameraStopDelegate): void;
|
|
21
21
|
off(eventType: 'cameraChange', callback: CameraChangeDelegate): void;
|
|
22
22
|
off(eventType: 'cameraStop', callback: CameraStopDelegate): void;
|
|
23
|
-
fitCameraToBoundingBox(boundingBox:
|
|
24
|
-
update(deltaTime: number, boundingBox:
|
|
23
|
+
fitCameraToBoundingBox(boundingBox: Box3, duration?: number | undefined, radiusFactor?: number | undefined): void;
|
|
24
|
+
update(deltaTime: number, boundingBox: Box3): void;
|
|
25
25
|
dispose(): void;
|
|
26
26
|
private onActiveCameraManagerChangeFired;
|
|
27
27
|
private onActiveCameraManagerStopFired;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright 2022 Cognite AS
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import { Box3, PerspectiveCamera, Vector3 } from 'three';
|
|
5
5
|
import { CameraManager } from './CameraManager';
|
|
6
6
|
import { CameraChangeDelegate, CameraEventDelegate, CameraManagerEventType, CameraState } from './types';
|
|
7
7
|
export declare class StationaryCameraManager implements CameraManager {
|
|
@@ -13,8 +13,8 @@ export declare class StationaryCameraManager implements CameraManager {
|
|
|
13
13
|
private readonly _stopEventTrigger;
|
|
14
14
|
private _isDragging;
|
|
15
15
|
private _pointerEventCache;
|
|
16
|
-
constructor(domElement: HTMLElement, camera:
|
|
17
|
-
getCamera():
|
|
16
|
+
constructor(domElement: HTMLElement, camera: PerspectiveCamera);
|
|
17
|
+
getCamera(): PerspectiveCamera;
|
|
18
18
|
get defaultFOV(): number;
|
|
19
19
|
setCameraState(state: CameraState): void;
|
|
20
20
|
getCameraState(): Required<CameraState>;
|
|
@@ -22,10 +22,10 @@ export declare class StationaryCameraManager implements CameraManager {
|
|
|
22
22
|
deactivate(): void;
|
|
23
23
|
on(eventType: CameraManagerEventType, callback: CameraEventDelegate): void;
|
|
24
24
|
off(eventType: CameraManagerEventType, callback: CameraChangeDelegate): void;
|
|
25
|
-
fitCameraToBoundingBox(boundingBox:
|
|
26
|
-
moveTo(targetPosition:
|
|
25
|
+
fitCameraToBoundingBox(boundingBox: Box3, _?: number, radiusFactor?: number): void;
|
|
26
|
+
moveTo(targetPosition: Vector3, duration?: number): Promise<void>;
|
|
27
27
|
setFOV(fov: number): void;
|
|
28
|
-
update(_: number, boundingBox:
|
|
28
|
+
update(_: number, boundingBox: Box3): void;
|
|
29
29
|
dispose(): void;
|
|
30
30
|
private enableDragging;
|
|
31
31
|
private disableDragging;
|