@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
113 lines (112 loc) • 4.46 kB
TypeScript
import { type ArcRotateCamera } from "../../Cameras/arcRotateCamera.js";
import { type ICameraInput } from "../../Cameras/cameraInputsManager.js";
/**
* Manage the keyboard inputs to control the movement of an arc rotate camera.
* @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs
*/
export declare class ArcRotateCameraKeyboardMoveInput implements ICameraInput<ArcRotateCamera> {
/**
* Defines the camera the input is attached to.
*/
camera: ArcRotateCamera;
/**
* Defines the list of key codes associated with the up action (increase alpha)
*/
keysUp: number[];
/**
* Defines the list of key codes associated with the down action (decrease alpha)
*/
keysDown: number[];
/**
* Defines the list of key codes associated with the left action (increase beta)
*/
keysLeft: number[];
/**
* Defines the list of key codes associated with the right action (decrease beta)
*/
keysRight: number[];
/**
* Defines the list of key codes associated with the reset action.
* Those keys reset the camera to its last stored state (with the method camera.storeState())
*/
keysReset: number[];
/**
* Defines the list of key codes associated with the zoom in action.
* Only used when CameraMovement is active — these keys always trigger zoom regardless of modifiers.
*/
keysZoomIn: number[];
/**
* Defines the list of key codes associated with the zoom out action.
* Only used when CameraMovement is active — these keys always trigger zoom regardless of modifiers.
*/
keysZoomOut: number[];
/**
* Defines the panning sensibility of the inputs.
* (How fast is the camera panning)
*/
panningSensibility: number;
/**
* Defines the zooming sensibility of the inputs.
* (How fast is the camera zooming)
*/
zoomingSensibility: number;
/**
* Rotation speed of the camera
*/
angularSpeed: number;
private _useAltToZoom;
/**
* Defines whether alt+arrows/wasd triggers zoom instead of rotation/pan.
* When disabled, alt+keyboard events are ignored by the zoom inputMap entry.
* Setting this updates the corresponding inputMap entry on the camera's movement system.
* If set before the camera is attached, the value is cached and applied during `attachControl`.
*/
get useAltToZoom(): boolean;
set useAltToZoom(value: boolean);
/**
* Applies the cached `_useAltToZoom` value to the camera's inputMap.
* Safe to call before the camera is attached: it is a no-op until `this.camera.movement` is available.
* Idempotent — calling it when the inputMap already matches the cached value is a no-op.
*/
private _applyUseAltToZoomToInputMap;
private _keys;
private _ctrlPressed;
private _altPressed;
private _onCanvasBlurObserver;
private _onKeyboardObserver;
private _engine;
private _scene;
/**
* Modifier state stored separately from `_keyboardConditions` so it can be typed as a
* concrete (non-optional) object. This avoids non-null assertions when updating modifier
* fields each frame, and the conditions object holds the same reference so
* resolveInteraction sees the live state.
*/
private _keyboardModifiers;
/** Cached conditions object to avoid per-frame allocations in checkInputs */
private _keyboardConditions;
/**
* Attach the input controls to a specific dom element to get the input from.
* @param noPreventDefault Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
*/
attachControl(noPreventDefault?: boolean): void;
/**
* Detach the current controls from the specified dom element.
*/
detachControl(): void;
/**
* Update the current camera state depending on the inputs that have been used this frame.
* This is a dynamically created lambda to avoid the performance penalty of looping for inputs in the render loop.
*/
checkInputs(): void;
/**
* Gets the class name of the current input.
* @returns the class name
*/
getClassName(): string;
/**
* Get the friendly name associated with the input class.
* @returns the input friendly name
*/
getSimpleName(): string;
}