RotateControl
Camera's rotation control
class RotateControl extends Component<RotateControlEvents> implements CameraControl
Extends
- Component<RotateControlEvents>
Implements
Properties
Whether this control is animating the camera
Disable rotation by keyboard.
Disable X-axis(pitch) rotation.
Disable Y-axis(yaw) rotation.
Duration of the input animation (ms)
Easing function of the animation
Whether this control is enabled or not
Scale factor for keyboard rotation
Current pitch value
Scale factor for mouse/touch rotation
If true
, enables scroll on mobile(touch) devices on canvas.
When this option is enabled, users must swipe horizontally first then vertically to change view up or down.
Current yaw value
Methods
Destroy the instance and remove all event listeners attached.
Disable this control and remove all event listeners
Enable this control and add event listeners.
Resize control to match target size.
Synchronize this control's state to current camera state
Constructor
new RotateControl(controlEl: HTMLElement, enableBlocked: boolean, options: Partial<RotateControlOptions>): RotateControl
Parameters
HTMLElement
Element to attach handlers
boolean
Whether to disable control on init
Options for control
Properties
animating
animatingboolean
Whether this control is animating the camera
disableKeyboard
disableKeyboardboolean
false
Disable rotation by keyboard.
disablePitch
disablePitchboolean
false
Disable X-axis(pitch) rotation.
disableYaw
disableYawboolean
false
Disable Y-axis(yaw) rotation.
duration
durationnumber
300
Duration of the input animation (ms)
easing
enabled
enabledboolean
Whether this control is enabled or not
keyboardScale
keyboardScale[number,number]
[1, 1]
Scale factor for keyboard rotation
pitch
pointerScale
pointerScale[number,number]
[1, 1]
Scale factor for mouse/touch rotation
scrollable
scrollableboolean
If true
, enables scroll on mobile(touch) devices on canvas.
When this option is enabled, users must swipe horizontally first then vertically to change view up or down.
yaw
Methods
destroy
destroyvoid
destroy(): void
Destroy the instance and remove all event listeners attached.
disable
disablevoid
disable(): void
Disable this control and remove all event listeners
enable
enablevoid
enable(): void
Enable this control and add event listeners.
hasOn
hasOnboolean
hasOn<K>(eventName: K): boolean
Parameters
K
off
off
off<K>(eventName: K, handlerToDetach: EventCallback<RotateControlEvents, K, RotateControl>): RotateControl
Parameters
K
EventCallback<RotateControlEvents, K, RotateControl>
on
on
on(eventHash: Partial<{ change: ((event: { delta: RotateDeltaType; isKeyboard: boolean; isTouch: boolean }) => any); disable: ((event: { updateCursor: boolean }) => any); enable: ((event: { control: CameraControl; updateCursor: boolean }) => any); inputEnd: ((event: { inputType: "zoom" | "rotate" } & { isKeyboard: boolean; isTouch: boolean; scrolling: boolean }) => any); inputStart: ((event: { inputType: "zoom" | "rotate" } & { isKeyboard: boolean; isTouch: boolean; srcEvent: MouseEvent | TouchEvent | KeyboardEvent }) => any); staticClick: ((event: { isTouch: boolean }) => any) }>): RotateControl
Parameters
Partial<{ change: ((event: { delta: RotateDeltaType; isKeyboard: boolean; isTouch: boolean }) => any); disable: ((event: { updateCursor: boolean }) => any); enable: ((event: { control: CameraControl; updateCursor: boolean }) => any); inputEnd: ((event: { inputType: "zoom" | "rotate" } & { isKeyboard: boolean; isTouch: boolean; scrolling: boolean }) => any); inputStart: ((event: { inputType: "zoom" | "rotate" } & { isKeyboard: boolean; isTouch: boolean; srcEvent: MouseEvent | TouchEvent | KeyboardEvent }) => any); staticClick: ((event: { isTouch: boolean }) => any) }>
once
once
once(eventHash: Partial<{ change: ((event: { delta: RotateDeltaType; isKeyboard: boolean; isTouch: boolean }) => any); disable: ((event: { updateCursor: boolean }) => any); enable: ((event: { control: CameraControl; updateCursor: boolean }) => any); inputEnd: ((event: { inputType: "zoom" | "rotate" } & { isKeyboard: boolean; isTouch: boolean; scrolling: boolean }) => any); inputStart: ((event: { inputType: "zoom" | "rotate" } & { isKeyboard: boolean; isTouch: boolean; srcEvent: MouseEvent | TouchEvent | KeyboardEvent }) => any); staticClick: ((event: { isTouch: boolean }) => any) }>): RotateControl
Parameters
Partial<{ change: ((event: { delta: RotateDeltaType; isKeyboard: boolean; isTouch: boolean }) => any); disable: ((event: { updateCursor: boolean }) => any); enable: ((event: { control: CameraControl; updateCursor: boolean }) => any); inputEnd: ((event: { inputType: "zoom" | "rotate" } & { isKeyboard: boolean; isTouch: boolean; scrolling: boolean }) => any); inputStart: ((event: { inputType: "zoom" | "rotate" } & { isKeyboard: boolean; isTouch: boolean; srcEvent: MouseEvent | TouchEvent | KeyboardEvent }) => any); staticClick: ((event: { isTouch: boolean }) => any) }>
resize
resizevoid
resize(hfov: number, aspect: number, width: number, height: number): void
Resize control to match target size.
Parameters
number
Camera horizontal fov in degrees
number
Camera aspect
number
New width
number
New height
sync
syncvoid
sync(camera: Camera): void
Synchronize this control's state to current camera state
Parameters
Camera's instance
trigger
trigger
trigger<K>(event: K, ...params: EventTriggerParams<RotateControlEvents, K>): RotateControl
Parameters
K
EventTriggerParams<RotateControlEvents, K>