-
Notifications
You must be signed in to change notification settings - Fork 18
/
types.ts
102 lines (92 loc) · 2.44 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*!
* Copyright 2021 Cognite AS
*/
export type CameraControlsOptions = {
/**
* Sets mouse wheel initiated action.
*
* Modes:
*
* 'zoomToTarget' - zooms just to the current target (center of the screen) of the camera.
*
* 'zoomPastCursor' - zooms in the direction of the ray coming from camera through cursor screen position, allows going through objects.
*
* 'zoomToCursor' - mouse wheel scroll zooms towards the point on the model where cursor is hovering over, doesn't allow going through objects.
*
* Default is 'zoomPastCursor'.
*
*/
mouseWheelAction?: 'zoomToTarget' | 'zoomPastCursor' | 'zoomToCursor';
/**
* 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.
*
* Default is false.
*
*/
changeCameraTargetOnClick?: boolean;
};
export type ControlsState = {
position: THREE.Vector3;
target: THREE.Vector3;
};
/**
* @internal
* */
export interface RevealCameraControls extends THREE.EventDispatcher {
enabled: boolean;
/**
* Method for updating controls state
*/
update: (deltaTime: number) => void;
/**
* Sets new state for controls
*/
setState: (position: THREE.Vector3, target: THREE.Vector3) => void;
/**
* Method for getting current controls state
*/
getState: () => { position: THREE.Vector3; target: THREE.Vector3 };
/**
* Sets view target (used for camera rotation animations) for controls.
*/
setViewTarget: (target: THREE.Vector3) => void;
/**
* Sets scroll target (used for different scrolling mechanics) for controls.
*/
setScrollTarget: (target: THREE.Vector3) => void;
}
export type CameraState = {
/**
* Camera position in world space.
*/
position?: THREE.Vector3;
/**
* Camera target in world space.
* **/
target?: THREE.Vector3;
/**
* Camera local rotation in quaternion form.
*/
rotation?: THREE.Quaternion;
};
/**
* Delegate for camera update events.
* @module @cognite/reveal
*/
export type CameraChangeDelegate = (position: THREE.Vector3, target: THREE.Vector3) => void;
export type CameraManagerCallbackData = {
intersection: {
/**
* Coordinate of the intersection.
*/
point: THREE.Vector3;
/**
* Distance from the camera to the intersection.
*/
distanceToCamera: number;
} | null;
/**
* Bounding box for all models on the scene
*/
modelsBoundingBox: THREE.Box3;
};