UNPKG

@acransac/vtk.js

Version:

Visualization Toolkit for the Web

47 lines (41 loc) 1.36 kB
import macro from 'vtk.js/Sources/macro'; export default function widgetBehavior(publicAPI, model) { model.classHierarchy.push('vtkInteractiveOrientationWidgetProp'); macro.event(publicAPI, model, 'OrientationChange'); // -------------------------------------------------------------------------- // Right click: Delete handle // -------------------------------------------------------------------------- publicAPI.handleRightButtonPress = (e) => { if ( !model.activeState || !model.activeState.getActive() || !model.pickable ) { return macro.VOID; } publicAPI.invokeOrientationChange({ action: 'rightPress', event: e, ...model.activeState.get('up', 'right', 'direction'), }); return macro.EVENT_ABORT; }; // -------------------------------------------------------------------------- // Left press: Select handle to drag // -------------------------------------------------------------------------- publicAPI.handleLeftButtonPress = (e) => { if ( !model.activeState || !model.activeState.getActive() || !model.pickable ) { return macro.VOID; } publicAPI.invokeOrientationChange({ action: 'leftPress', event: e, ...model.activeState.get('up', 'right', 'direction'), }); return macro.EVENT_ABORT; }; }