Skip to content

Commit

Permalink
feat(KeyboardCameraManipulator): Add typescript
Browse files Browse the repository at this point in the history
Add index.d.ts file for vtkKeyboardCameraManipulator
  • Loading branch information
unknown authored and Jo-Byr committed Nov 13, 2024
1 parent 1ca5ba1 commit d1024c0
Showing 1 changed file with 113 additions and 0 deletions.
113 changes: 113 additions & 0 deletions Sources/Interaction/Manipulators/KeyboardCameraManipulator/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import { Vector3 } from '../../../types';
import { vtkObject } from '../../../interfaces';
import vtkCompositeKeyboardManipulator from '../CompositeKeyboardManipulator';
import vtkRenderWindowInteractor from '../../../Rendering/Core/RenderWindowInteractor';
import vtkCamera from '../../../Rendering/Core/Camera';
import vtkRenderer from '../../../Rendering/Core/Renderer';

export interface vtkKeyboardCameraManipulator
extends vtkObject,
vtkCompositeKeyboardManipulator {
/**
* Returns whether a movement is ongoing.
*/
inMotion(): boolean;

/**
* Reset the movement speed to be proportional to the longest length of the renderer's bounds.
*/
resetMovementSpeed(): void;

/**
* Initialize a movement of the current camera.
*/
startMovement(): void;

/**
* Cancel any ongoing camera movement.
*/
endMovement(): void;

/**
* Update active camera direction, depending on currently pressed keys.
*/
calculateCurrentDirection(): void;

/**
* Returns the direction vector of the given camera for the given key.
* @param key the movedkey
* @param camera the camera
*/
getDirectionFromKey(key: KeyboardEvent['key'], camera: vtkCamera): Vector3;

/**
* Moves the given camera, in the given direction, at the given speed.
* @param camera the moved camera
* @param direction the direction of the movemnt
* @param speed the speed
*/
moveCamera(camera: vtkCamera, direction: Vector3, speed: number): void;

/**
* Handles a keypress event.
* @param interactor the interactor
* @param renderer the renderer
* @param key the key
*/
onKeyPress(
interactor: vtkRenderWindowInteractor,
renderer: vtkRenderer,
key: KeyboardEvent['key']
): void;

/**
* Handles a keydown event.
* @param interactor the interactor
* @param renderer the renderer
* @param key the key
*/
onKeyDown(
interactor: vtkRenderWindowInteractor,
renderer: vtkRenderer,
key: KeyboardEvent['key']
): void;

/**
* Handles a keyup event.
* @param interactor the interactor
* @param renderer the renderer
* @param key the key
*/
onKeyUp(
interactor: vtkRenderWindowInteractor,
renderer: vtkRenderer,
key: KeyboardEvent['key']
): void;
}

export interface IKeyboardCameraManipulatorInitialValues {
movementSpeed?: number;
moveForwardKeys?: KeyboardEvent['key'][];
moveLeftKeys?: KeyboardEvent['key'][];
moveBackwardKeys?: KeyboardEvent['key'][];
moveRightKeys?: KeyboardEvent['key'][];
moveUpKeys?: KeyboardEvent['key'][];
moveDownKeys?: KeyboardEvent['key'][];
}

export function newInstance(
initialValues?: IKeyboardCameraManipulatorInitialValues
): vtkKeyboardCameraManipulator;

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

export const vtkKeyboardCameraManipulator: {
newInstance: typeof newInstance;
extend: typeof extend;
};

export default vtkKeyboardCameraManipulator;

0 comments on commit d1024c0

Please sign in to comment.