Skip to main content

ZoomControl

Since version 4.0.0

Camera's zoom control

class ZoomControl extends Component<ZoomControlEvents> implements CameraControl

Extends

Implements

Properties

Whether this control is animating the camera

Duration of the input animation (ms)

Easing function of the animation

Whether this control is enabled or not

Scale factor of the zoom

If true, enables scroll by mouse wheel on canvas.

caution

When this option is enabled, zoom by mouse wheel will be disabled.

Current zoom 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.

Synchronize this control's state to current camera state

Constructor

Create new ZoomControl instance
new ZoomControl(controlEl: HTMLElement, enableBlocked: boolean, options: Partial<ZoomControlOptions>): ZoomControl

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

duration

>=4.0.0
readonly
duration

number

300

Duration of the input animation (ms)

easing

>=4.0.0
readonly
easing

((x: number) => number)

EASING.EASE_OUT_CUBIC

Easing function of the animation

enabled

readonly
enabled

boolean

Whether this control is enabled or not

scale

>=4.0.0
scale

number

1

Scale factor of the zoom

scrollable

scrollable

boolean

If true, enables scroll by mouse wheel on canvas.

caution

When this option is enabled, zoom by mouse wheel will be disabled.

zoom

>=4.0.0
readonly
zoom

number

Current zoom 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

ZoomControl

off<K>(eventName: K, handlerToDetach: EventCallback<ZoomControlEvents, K, ZoomControl>): ZoomControl

Parameters

eventName

K

handlerToDetach

EventCallback<ZoomControlEvents, K, ZoomControl>

on

inherited
on

ZoomControl

on(eventHash: Partial<{ change: ((event: { delta: number; 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) }>): ZoomControl

Parameters

eventHash

Partial<{ change: ((event: { delta: number; 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

ZoomControl

once(eventHash: Partial<{ change: ((event: { delta: number; 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) }>): ZoomControl

Parameters

eventHash

Partial<{ change: ((event: { delta: number; 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) }>

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

ZoomControl

trigger<K>(event: K, ...params: EventTriggerParams<ZoomControlEvents, K>): ZoomControl

Parameters

event

K

params

EventTriggerParams<ZoomControlEvents, K>