-
-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3171 from Jo-Byr/typescript-keyboardcameramanipul…
…ator feat(KeyboardCameraManipulator): Add typescript
- Loading branch information
Showing
1 changed file
with
113 additions
and
0 deletions.
There are no files selected for viewing
113 changes: 113 additions & 0 deletions
113
Sources/Interaction/Manipulators/KeyboardCameraManipulator/index.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |