All files / Sources/Interaction/Manipulators/CompositeCameraManipulator index.js

72.72% Statements 8/11
0% Branches 0/1
66.66% Functions 2/3
72.72% Lines 8/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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                72x     72x                               1x                 72x     72x 72x 72x     72x            
import macro from 'vtk.js/Sources/macros';
 
// ----------------------------------------------------------------------------
// 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 };