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

88.88% Statements 16/18
0% Branches 0/1
16.66% Functions 2/12
100% Lines 16/16

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 52 53                71x   71x 71x 71x 71x 71x 71x 71x 71x   71x 71x             1x                       71x     71x 71x     71x            
import macro from 'vtk.js/Sources/macros';
 
// ----------------------------------------------------------------------------
// vtkCompositeMouseManipulator methods
// ----------------------------------------------------------------------------
 
function vtkCompositeMouseManipulator(publicAPI, model) {
  // Set our className
  model.classHierarchy.push('vtkCompositeMouseManipulator');
 
  publicAPI.startInteraction = () => {};
  publicAPI.endInteraction = () => {};
  publicAPI.onButtonDown = (interactor, renderer, position) => {};
  publicAPI.onButtonUp = (interactor) => {};
  publicAPI.onMouseMove = (interactor, renderer, position) => {};
  publicAPI.onStartScroll = (interactor, renderer, delta) => {};
  publicAPI.onScroll = (interactor, renderer, delta) => {};
  publicAPI.onEndScroll = (interactor) => {};
 
  publicAPI.isDragEnabled = () => model.dragEnabled;
  publicAPI.isScrollEnabled = () => model.scrollEnabled;
}
 
// ----------------------------------------------------------------------------
// Object factory
// ----------------------------------------------------------------------------
 
const DEFAULT_VALUES = {
  button: 1,
  shift: false,
  control: false,
  alt: false,
  dragEnabled: true,
  scrollEnabled: false,
};
 
// ----------------------------------------------------------------------------
 
export function extend(publicAPI, model, initialValues = {}) {
  Object.assign(model, DEFAULT_VALUES, initialValues);
 
  // Create get-set macros
  macro.setGet(publicAPI, model, ['button', 'shift', 'control', 'alt']);
  macro.set(publicAPI, model, ['dragEnabled', 'scrollEnabled']);
 
  // Object specific methods
  vtkCompositeMouseManipulator(publicAPI, model);
}
 
// ----------------------------------------------------------------------------
 
export default { extend };