Skip to main content

RotateControl

Since version 4.0.0

Camera's rotation control

class RotateControl extends Component<RotateControlEvents> implements CameraControl

Extends

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.

caution

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

Create new RotateControl instance
new RotateControl(controlEl: HTMLElement, enableBlocked: boolean, options: Partial<RotateControlOptions>): RotateControl

Parameters

controlEl

HTMLElement

Element to attach handlers

enableBlocked

boolean

Whether to disable control on init

options

{}

Options for control

Properties

animating

readonly
animating

boolean

Whether this control is animating the camera

disableKeyboard

disableKeyboard

boolean

false

Disable rotation by keyboard.

disablePitch

disablePitch

boolean

false

Disable X-axis(pitch) rotation.

disableYaw

disableYaw

boolean

false

Disable Y-axis(yaw) rotation.

duration

duration

number

300

Duration of the input animation (ms)

easing

easing

((x: number) => number)

EASING.EASE_OUT_CUBIC

Easing function of the animation

enabled

readonly
enabled

boolean

Whether this control is enabled or not

keyboardScale

>=4.0.0
keyboardScale

[number,number]

[1, 1]

Scale factor for keyboard rotation

pitch

>=4.0.0
readonly
pitch

Motion

Current pitch value

pointerScale

>=4.0.0
pointerScale

[number,number]

[1, 1]

Scale factor for mouse/touch rotation

scrollable

scrollable

boolean

If true, enables scroll on mobile(touch) devices on canvas.

caution

When this option is enabled, users must swipe horizontally first then vertically to change view up or down.

yaw

>=4.0.0
readonly
yaw

Motion

Current yaw value

Methods

destroy

>=4.0.0
destroy

void

destroy(): void

Destroy the instance and remove all event listeners attached.

disable

>=4.0.0
disable

void

disable(): void

Disable this control and remove all event listeners

enable

>=4.0.0
enable

void

enable(): void

Enable this control and add event listeners.

hasOn

inherited
hasOn

boolean

hasOn<K>(eventName: K): boolean

Parameters

eventName

K

off

inherited
off

RotateControl

off<K>(eventName: K, handlerToDetach: EventCallback<RotateControlEvents, K, RotateControl>): RotateControl

Parameters

eventName

K

handlerToDetach

EventCallback<RotateControlEvents, K, RotateControl>

on

inherited
on

RotateControl

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

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) }>

once

inherited
once

RotateControl

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

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) }>

resize

resize

void

resize(hfov: number, aspect: number, width: number, height: number): void

Resize control to match target size.

Parameters

hfov

number

Camera horizontal fov in degrees

aspect

number

Camera aspect

width

number

New width

height

number

New height

sync

>=4.0.0
sync

void

sync(camera: Camera): void

Synchronize this control's state to current camera state

Parameters

camera

Camera's instance

trigger

inherited
trigger

RotateControl

trigger<K>(event: K, ...params: EventTriggerParams<RotateControlEvents, K>): RotateControl

Parameters

event

K

params

EventTriggerParams<RotateControlEvents, K>