Class
PanCamera2DController
View sourceExtends CameraController
Camera controls for 2D scenes.
A left-button drag pans the camera, a right- or middle-button drag rotates it around the Z axis, and the wheel zooms. On touch devices one finger pans while a two-finger gesture pans, zooms, and rotates at the same time.
Zoom is applied through the camera transform scale, so the controller works with an orthographic projection without taking ownership of its bounds.
Constructor
View source
Properties
zoom : number
View sourceCamera zoom multiplier. Values above one zoom in.
Default: 1
minZoom : number
View sourceDefault: 0.01
maxZoom : number
View sourceDefault: 100
rotation : number
View sourceCamera rotation around the Z axis, in radians.
Default: 0
panSensitivity : number
View sourceMultiplier applied to the screen-to-world pan distance.
Default: 1
rotationSensitivity : number
View sourceDefault: 0.005
zoomSensitivity : number
View sourceDefault: 0.001
Methods
syncFromCamera ( ) : PanCamera2DController
View source Synchronizes the controller with the camera’s current orientation and scale. Calling this resets the controller zoom to one.
update ( ) : void
View source updateMouseInput ( ) : void
View source Applies the current mouse drag to the camera.
onTouchMove ( event: PointerEvent , previousX: number , previousY: number ) : void
View source onWheel ( event: WheelEvent ) : void
View source setZoom ( zoom: number ) : PanCamera2DController
View source Sets and clamps the zoom multiplier.
applyPanFromScreenDelta ( deltaX: number , deltaY: number ) : void
View source Applies a screen-space drag to the camera position. The Y direction is inverted so content follows the pointer in the viewport.