CompositeMouseManipulator

Methods

endInteraction

Ends an interaction event.

getAlt

Gets flag if alt key is required.

getButton

Gets the associated button.

getControl

Gets flag if control key is required.

getShift

Gets flag if shift key is required.

isDragEnabled

Is drag enabled.

isScrollEnabled

Is scroll enabled.

onButtonDown

Handles a button down event.

Argument Type Required Description
interactor Yes the interactor
renderer Yes the renderer
position Yes the display position

onButtonUp

Handles a button up event.

Argument Type Required Description
interactor Yes the interactor

onEndScroll

Handles a scroll event.

Argument Type Required Description
interactor Yes the interactor

onMouseMove

Handles a mouse move event.

Argument Type Required Description
interactor Yes the interactor
renderer Yes the renderer
position Yes the display position

onStartScroll

Handles a start scroll event.

Argument Type Required Description
interactor Yes the interactor
renderer Yes the renderer
delta Yes the scroll delta

setAlt

Sets if the alt key is required.

Argument Type Required Description
alt Yes

setButton

Sets the associated button.

Argument Type Required Description
btn Yes

setControl

Sets if the control key is required.

Argument Type Required Description
ctrl Yes

setDragEnabled

Sets if drag is enabled.

Argument Type Required Description
enabled Yes

setScrollEnabled

Sets if scroll is enabled.

Argument Type Required Description
enabled Yes

setShift

Sets if the shift key is required.

Argument Type Required Description
shift Yes

startInteraction

Starts an interaction event.

Source

index.d.ts
import vtkRenderer from '../../../Rendering/Core/Renderer';
import vtkRenderWindowInteractor from '../../../Rendering/Core/RenderWindowInteractor';

export interface vtkCompositeMouseManipulator {
/**
* Starts an interaction event.
*/
startInteraction(): void;

/**
* Ends an interaction event.
*/
endInteraction(): void;

/**
* Handles a button down event.
* @param interactor the interactor
* @param renderer the renderer
* @param position the display position
*/
onButtonDown(
interactor: vtkRenderWindowInteractor,
renderer: vtkRenderer,
position: { x: number; y: number }
): void;

/**
* Handles a button up event.
* @param interactor the interactor
*/
onButtonUp(interactor: vtkRenderWindowInteractor): void;

/**
* Handles a mouse move event.
* @param interactor the interactor
* @param renderer the renderer
* @param position the display position
*/
onMouseMove(
interactor: vtkRenderWindowInteractor,
renderer: vtkRenderer,
position: { x: number; y: number }
): void;

/**
* Handles a start scroll event.
* @param interactor the interactor
* @param renderer the renderer
* @param delta the scroll delta
*/
onStartScroll(
interactor: vtkRenderWindowInteractor,
renderer: vtkRenderer,
delta: number
): void;

/**
* Handles a scroll event.
* @param interactor the interactor
*/
onEndScroll(interactor: vtkRenderWindowInteractor): void;

/**
* Is drag enabled.
*/
isDragEnabled(): boolean;

/**
* Sets if drag is enabled.
* @param enabled
*/
setDragEnabled(enabled: boolean): boolean;

/**
* Is scroll enabled.
*/
isScrollEnabled(): boolean;

/**
* Sets if scroll is enabled.
* @param enabled
*/
setScrollEnabled(enabled: boolean): boolean;

/**
* Sets the associated button.
* @param btn
*/
setButton(btn: number): boolean;

/**
* Gets the associated button.
*/
getButton(): number;

/**
* Sets if the shift key is required.
* @param shift
*/
setShift(shift: boolean): boolean;

/**
* Gets flag if shift key is required.
*/
getShift(): boolean;

/**
* Sets if the control key is required.
* @param ctrl
*/
setControl(ctrl: boolean): boolean;

/**
* Gets flag if control key is required.
*/
getControl(): boolean;

/**
* Sets if the alt key is required.
* @param alt
*/
setAlt(alt: boolean): boolean;

/**
* Gets flag if alt key is required.
*/
getAlt(): boolean;
}

export interface ICompositeMouseManipulatorInitialValues {
button?: number;
shift?: boolean;
control?: boolean;
alt?: boolean;
dragEnabled?: boolean;
scrollEnabled?: boolean;
}

export function extend(
publicAPI: object,
model: object,
initialValues?: ICompositeMouseManipulatorInitialValues
): void;

export const vtkCompositeMouseManipulator: {
extend: typeof extend;
};

export default vtkCompositeMouseManipulator;
index.js
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 };