forked from Kitware/vtk-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
50 lines (39 loc) · 1.57 KB
/
index.js
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
import macro from 'vtk.js/Sources/macro';
// ----------------------------------------------------------------------------
// vtkCompositeCameraManipulator methods
// ----------------------------------------------------------------------------
function vtkCompositeCameraManipulator(publicAPI, model) {
// Set our className
model.classHierarchy.push('vtkCompositeCameraManipulator');
//-------------------------------------------------------------------------
publicAPI.computeDisplayCenter = (iObserver, renderer) => {
const pt = iObserver.computeWorldToDisplay(
renderer,
model.center[0],
model.center[1],
model.center[2]
);
model.displayCenter[0] = pt[0];
model.displayCenter[1] = pt[1];
};
}
// ----------------------------------------------------------------------------
// Object factory
// ----------------------------------------------------------------------------
const DEFAULT_VALUES = {
center: [0, 0, 0],
rotationFactor: 1,
displayCenter: [0, 0],
};
// ----------------------------------------------------------------------------
export function extend(publicAPI, model, initialValues = {}) {
Object.assign(model, DEFAULT_VALUES, initialValues);
// Create get-set macros
macro.setGet(publicAPI, model, ['rotationFactor']);
macro.setGetArray(publicAPI, model, ['displayCenter'], 2);
macro.setGetArray(publicAPI, model, ['center'], 3);
// Object specific methods
vtkCompositeCameraManipulator(publicAPI, model);
}
// ----------------------------------------------------------------------------
export default { extend };