Skip to main content

ZoomControl

class ZoomControl extends Component implements CameraControl, OptionGetters<ZoomControlOptions>

Distance controller handling both mouse wheel and pinch zoom(fov)

constructor

new ZoomControl(view3D, options)

Create new ZoomControl instance

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
view3DView3DAn instance of View3D
optionsZoomControlOptions✔️{}Options

Properties

enabled

readonly

Whether this control is enabled or not

animating

readonly

Whether this control is animating the camera

Type: boolean

range

readonly

Currenet fov/distance range

Type: Range

type

readonly

Current control type

Default: "fov"

See:

  • {ZOOM_TYPE}

scale

Scale factor of the zoom

Type: number

Default: 1

duration

Duration of the input animation (ms)

Type: number

Default: 300

minFov

Minimum vertical fov(field of view).
Only available when type is "fov".
You can get a bigger image with the smaller value of this.

Type: number

Default: 1

maxFov

Maximum vertical fov(field of view).
Only available when type is "fov".
You can get a smaller image with the bigger value of this.
If "auto" is given, it will use Math.min(default fov + 45, 175).

Type: "auto" | number

Default: "auto"

minDistance

Minimum camera distance. This will be scaled to camera's default distance(Camera#baseDistance)
Only available when type is "distance".

Type: number

Default: 0.1

maxDistance

Maximum camera distance. This will be scaled to camera's default distance(Camera#baseDistance)
Only available when type is "distance".

Type: number

Default: 2

easing

Easing function of the animation

Type: function

Default: EASING.EASE_OUT_CUBIC

See:

Methods

destroy

Destroy the instance and remove all event listeners attached

Returns: void

reset

Reset internal values

Returns: void

update

Update control by given deltaTime

Returns: void

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
deltaTimenumberNumber of milisec to update

enable

Enable this input and add event listeners

Returns: void

disable

Disable this input and remove all event handlers

Returns: void

sync

Synchronize this control's state to given camera position

Returns: void

updateRange

Update fov range by the camera's current fov value

Returns: void