UNPKG

@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.

85 lines (84 loc) 3.1 kB
import { type GeospatialCamera } from "../geospatialCamera.js"; import { type ICameraInput } from "../cameraInputsManager.js"; /** * Manage the keyboard inputs to control the movement of a geospatial camera. * Arrow keys + Modifier key (ctrl/alt/option on mac): rotate * Arrow keys alone: pan * + / - keys: zoom in/out * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/customizingCameraInputs */ export declare class GeospatialCameraKeyboardInput implements ICameraInput<GeospatialCamera> { /** * Defines the camera the input is attached to. */ camera: GeospatialCamera; /** * Defines the list of key codes associated with the up action (pan up) */ keysUp: number[]; /** * Defines the list of key codes associated with the down action (pan down) */ keysDown: number[]; /** * Defines the list of key codes associated with the left action (pan left) */ keysLeft: number[]; /** * Defines the list of key codes associated with the right action (pan right) */ keysRight: number[]; /** * Defines the list of key codes associated with zoom in (+ or =) */ keysZoomIn: number[]; /** * Defines the list of key codes associated with zoom out (-) */ keysZoomOut: number[]; /** * Defines the rotation sensitivity of the inputs. * (How many pixels of pointer input to apply per keypress, before rotation speed factor is applied by movement class) */ rotationSensitivity: number; /** * Defines the panning sensitivity of the inputs. * (How many pixels of pointer input to apply per keypress, before pan speed factor is applied by movement class) */ panSensitivity: number; /** * Defines the zooming sensitivity of the inputs. * (How many pixels of pointer input to apply per keypress, before zoom speed factor is applied by movement class) */ zoomSensitivity: number; private _keys; private _modifierPressed; private _onCanvasBlurObserver; private _onKeyboardObserver; private _engine; private _scene; /** * 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; }