ZoomControl
Camera's zoom control
class ZoomControl extends Component<ZoomControlEvents> implements CameraControl
Extends
- Component<ZoomControlEvents>
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.
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
new ZoomControl(controlEl: HTMLElement, enableBlocked: boolean, options: Partial<ZoomControlOptions>): ZoomControl
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
duration
durationnumber
300
Duration of the input animation (ms)
easing
enabled
enabledboolean
Whether this control is enabled or not
scale
scalenumber
1
Scale factor of the zoom
scrollable
scrollableboolean
If true
, enables scroll by mouse wheel on canvas.
When this option is enabled, zoom by mouse wheel will be disabled.
zoom
zoomnumber
Current zoom value
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<ZoomControlEvents, K, ZoomControl>): ZoomControl
Parameters
K
EventCallback<ZoomControlEvents, K, ZoomControl>
on
on
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
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
once
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
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
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<ZoomControlEvents, K>): ZoomControl
Parameters
K
EventTriggerParams<ZoomControlEvents, K>