CompositeGestureManipulator

Methods

endInteraction

Ends an interaction event.

getInteractorStyle

Gets the interactor style.

getPanEnabled

Gets flag if pan is enabled.

getPinchEnabled

Gets flag if pinch is enabled.

getRotateEnabled

Gets flag if rotate is enabled.

isPanEnabled

Is pan enabled.

isPinchEnabled

Is pinch enabled.

isRotateEnabled

Is rotate enabled.

onEndPan

Handles an end pan gesture.

Argument Type Required Description
interactor Yes

onEndPinch

Handles an end pinch gesture.

Argument Type Required Description
interactor Yes

onEndRotate

Handles an end pinch gesture.

Argument Type Required Description
interactor Yes

onPan

Handles a pan gesture.

Argument Type Required Description
interactor Yes
renderer Yes
translation Yes

onPinch

Handles a pinch gesture.

Argument Type Required Description
interactor Yes
renderer Yes
scale Yes

onRotate

Handles a rotate gesture.

Argument Type Required Description
interactor Yes
renderer Yes
rotation Yes

onStartPan

Handles a start pan gesture.

Argument Type Required Description
interactor Yes
translation Yes

onStartPinch

Handles a start pinch gesture.

Argument Type Required Description
interactor Yes
scale Yes

onStartRotate

Handles a start rotate gesture.

Argument Type Required Description
interactor Yes
rotation Yes

setInteractorStyle

Sets the interactor style.

Argument Type Required Description
style Yes vtkInteractorStyle

setPanEnabled

Sets if pan is enabled.

Argument Type Required Description
pan Yes

setPinchEnabled

Sets if pinch is enabled.

Argument Type Required Description
pinch Yes

setRotateEnabled

Sets if rotate is enabled.

Argument Type Required Description
rotate Yes

startInteraction

Starts an interaction event.

Source

index.d.ts
import vtkInteractorStyle from '../../../Rendering/Core/InteractorStyle';
import vtkRenderer from '../../..//Rendering/Core/Renderer';
import vtkRenderWindowInteractor from '../../../Rendering/Core/RenderWindowInteractor';
import { Nullable } from '../../../types';

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

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

/**
* Handles a start pinch gesture.
* @param interactor
* @param scale
*/
onStartPinch(interactor: vtkRenderWindowInteractor, scale: number): void;

/**
* Handles a pinch gesture.
* @param interactor
* @param renderer
* @param scale
*/
onPinch(
interactor: vtkRenderWindowInteractor,
renderer: vtkRenderer,
scale: number
): void;

/**
* Handles an end pinch gesture.
* @param interactor
*/
onEndPinch(interactor: vtkRenderWindowInteractor): void;

/**
* Handles a start rotate gesture.
* @param interactor
* @param rotation
*/
onStartRotate(interactor: vtkRenderWindowInteractor, rotation: number): void;

/**
* Handles a rotate gesture.
* @param interactor
* @param renderer
* @param rotation
*/
onRotate(
interactor: vtkRenderWindowInteractor,
renderer: vtkRenderer,
rotation: number
): void;

/**
* Handles an end pinch gesture.
* @param interactor
*/
onEndRotate(interactor: vtkRenderWindowInteractor): void;

/**
* Handles a start pan gesture.
* @param interactor
* @param translation
*/
onStartPan(interactor: vtkRenderWindowInteractor, translation: number): void;

/**
* Handles a pan gesture.
* @param interactor
* @param renderer
* @param translation
*/
onPan(
interactor: vtkRenderWindowInteractor,
renderer: vtkRenderer,
translation: number
): void;

/**
* Handles an end pan gesture.
* @param interactor
*/
onEndPan(interactor: vtkRenderWindowInteractor): void;

/**
* Is pinch enabled.
*/
isPinchEnabled(): boolean;

/**
* Sets if pinch is enabled.
* @param pinch
*/
setPinchEnabled(pinch: boolean): boolean;

/**
* Gets flag if pinch is enabled.
*/
getPinchEnabled(): boolean;

/**
* Is pan enabled.
*/
isPanEnabled(): boolean;

/**
* Sets if pan is enabled.
* @param pan
*/
setPanEnabled(pan: boolean): boolean;

/**
* Gets flag if pan is enabled.
*/
getPanEnabled(): boolean;

/**
* Is rotate enabled.
*/
isRotateEnabled(): boolean;

/**
* Sets if rotate is enabled.
* @param rotate
*/
setRotateEnabled(rotate: boolean): boolean;

/**
* Gets flag if rotate is enabled.
*/
getRotateEnabled(): boolean;

/**
* Sets the interactor style.
* @param style vtkInteractorStyle
*/
setInteractorStyle(style: Nullable<vtkInteractorStyle>): boolean;

/**
* Gets the interactor style.
*/
getInteractorStyle(): Nullable<vtkInteractorStyle>;
}

export interface ICompositeGestureManipulatorInitialValues {
pinchEnabled?: boolean;
panEnabled?: boolean;
rotateEnabled?: boolean;
}

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

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

export default vtkCompositeGestureManipulator;
index.js
import macro from 'vtk.js/Sources/macros';

// ----------------------------------------------------------------------------
// vtkCompositeMouseManipulator methods
// ----------------------------------------------------------------------------

function vtkCompositeGestureManipulator(publicAPI, model) {
// Set our className
model.classHierarchy.push('vtkCompositeGestureManipulator');

publicAPI.startInteraction = () => {};
publicAPI.endInteraction = () => {};

publicAPI.onStartPinch = (interactor, scale) => {};
publicAPI.onStartRotate = (interactor, rotation) => {};
publicAPI.onStartPan = (interactor, translation) => {};
publicAPI.onPinch = (interactor, renderer, scale) => {};
publicAPI.onRotate = (interactor, renderer, rotation) => {};
publicAPI.onPan = (interactor, renderer, translation) => {};
publicAPI.onEndPinch = (interactor) => {};
publicAPI.onEndRotate = (interactor) => {};
publicAPI.onEndPan = (interactor) => {};

publicAPI.isPinchEnabled = () => model.pinchEnabled;
publicAPI.isPanEnabled = () => model.panEnabled;
publicAPI.isRotateEnabled = () => model.rotateEnabled;
}

// ----------------------------------------------------------------------------
// Object factory
// ----------------------------------------------------------------------------

const DEFAULT_VALUES = {
pinchEnabled: true,
panEnabled: true,
rotateEnabled: true,
};

// ----------------------------------------------------------------------------

export function extend(publicAPI, model, initialValues = {}) {
Object.assign(model, DEFAULT_VALUES, initialValues);

// Create get-set macros
macro.set(publicAPI, model, ['pinchEnabled', 'panEnabled', 'rotateEnabled']);
macro.setGet(publicAPI, model, ['interactorStyle']);

// Object specific methods
vtkCompositeGestureManipulator(publicAPI, model);
}

// ----------------------------------------------------------------------------

export default { extend };