Skip to main content

Class: Camera

Camera class

Extends

  • TypedEventEmitter<CameraEvents>

Implements

  • CameraState

Constructors

new Camera()

new Camera(): Camera

Returns

Camera

Overrides

TypedEventEmitter<CameraEvents>.constructor

Defined in

sigma/src/core/camera.ts:45

Properties

angle

angle: number = 0

Implementation of

CameraState.angle

Defined in

sigma/src/core/camera.ts:29


animationCallback()?

optional animationCallback: () => void

Returns

void

Defined in

sigma/src/core/camera.ts:43


clean

clean: null | (state) => CameraState = null

Defined in

sigma/src/core/camera.ts:37


enabledPanning

enabledPanning: boolean = true

Defined in

sigma/src/core/camera.ts:35


enabledRotation

enabledRotation: boolean = true

Defined in

sigma/src/core/camera.ts:36


enabledZooming

enabledZooming: boolean = true

Defined in

sigma/src/core/camera.ts:34


maxRatio

maxRatio: null | number = null

Defined in

sigma/src/core/camera.ts:33


minRatio

minRatio: null | number = null

Defined in

sigma/src/core/camera.ts:32


ratio

ratio: number = 1

Implementation of

CameraState.ratio

Defined in

sigma/src/core/camera.ts:30


rawEmitter

rawEmitter: EventEmitter<DefaultEventMap>

Inherited from

TypedEventEmitter.rawEmitter

Defined in

sigma/src/types.ts:114


x

x: number = 0.5

Implementation of

CameraState.x

Defined in

sigma/src/core/camera.ts:27


y

y: number = 0.5

Implementation of

CameraState.y

Defined in

sigma/src/core/camera.ts:28

Methods

addListener()

addListener<Event>(type, listener): this

Type Parameters

Event extends "updated"

Parameters

type: Event

listener: CameraEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.addListener

Defined in

sigma/src/types.ts:120


animate()

animate(state, opts, callback)

animate(state, opts, callback): void

Method used to animate the camera.

Parameters

state: Partial<CameraState>

opts: Partial<AnimateOptions>

callback

Returns

void

Defined in

sigma/src/core/camera.ts:173

animate(state, opts)

animate(state, opts?): Promise<void>

Parameters

state: Partial<CameraState>

opts?: Partial<AnimateOptions>

Returns

Promise<void>

Defined in

sigma/src/core/camera.ts:174


animatedReset()

animatedReset(options?): Promise<void>

Method used to reset the camera.

Parameters

options?: Partial<AnimateOptions>

Returns

Promise<void>

Defined in

sigma/src/core/camera.ts:276


animatedUnzoom()

animatedUnzoom(factorOrOptions?): Promise<void>

Method used to unzoom the camera.

Parameters

factorOrOptions?: number | Partial<AnimateOptions> & object

Returns

Promise<void>

Defined in

sigma/src/core/camera.ts:260


animatedZoom()

animatedZoom(factorOrOptions?): Promise<void>

Method used to zoom the camera.

Parameters

factorOrOptions?: number | Partial<AnimateOptions> & object

Returns

Promise<void>

Defined in

sigma/src/core/camera.ts:244


copy()

copy(): Camera

Returns a new Camera instance, with the same state as the current camera.

Returns

Camera

Defined in

sigma/src/core/camera.ts:291


disable()

disable(): this

Method used to disable the camera.

Returns

this

Defined in

sigma/src/core/camera.ts:71


emit()

emit<Event>(type, ...args): boolean

Type Parameters

Event extends "updated"

Parameters

type: Event

• ...args: Parameters<CameraEvents[Event]>

Returns

boolean

Inherited from

TypedEventEmitter.emit

Defined in

sigma/src/types.ts:119


enable()

enable(): this

Method used to enable the camera.

Returns

this

Defined in

sigma/src/core/camera.ts:63


eventNames()

eventNames<Event>(): Event[]

Type Parameters

Event extends "updated"

Returns

Event[]

Inherited from

TypedEventEmitter.eventNames

Defined in

sigma/src/types.ts:116


getBoundedRatio()

getBoundedRatio(ratio): number

Method used to check minRatio and maxRatio values.

Parameters

ratio: number

Returns

number

Defined in

sigma/src/core/camera.ts:114


getMaxListeners()

getMaxListeners(): number

Returns

number

Inherited from

TypedEventEmitter.getMaxListeners

Defined in

sigma/src/types.ts:118


getPreviousState()

getPreviousState(): null | CameraState

Method used to retrieve the camera's previous state.

Returns

null | CameraState

Defined in

sigma/src/core/camera.ts:98


getState()

getState(): CameraState

Method used to retrieve the camera's current state.

Returns

CameraState

Defined in

sigma/src/core/camera.ts:79


hasState()

hasState(state): boolean

Method used to check whether the camera has the given state.

Parameters

state: CameraState

Returns

boolean

Defined in

sigma/src/core/camera.ts:91


isAnimated()

isAnimated(): boolean

Method used to check whether the camera is currently being animated.

Returns

boolean

Defined in

sigma/src/core/camera.ts:137


listenerCount()

listenerCount<Event>(type): number

Type Parameters

Event extends "updated"

Parameters

type: Event

Returns

number

Inherited from

TypedEventEmitter.listenerCount

Defined in

sigma/src/types.ts:129


listeners()

listeners<Event>(type): CameraEvents[Event][]

Type Parameters

Event extends "updated"

Parameters

type: Event

Returns

CameraEvents[Event][]

Inherited from

TypedEventEmitter.listeners

Defined in

sigma/src/types.ts:128


off()

off<Event>(type, listener): this

Type Parameters

Event extends "updated"

Parameters

type: Event

listener: CameraEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.off

Defined in

sigma/src/types.ts:126


on()

on<Event>(type, listener): this

Type Parameters

Event extends "updated"

Parameters

type: Event

listener: CameraEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.on

Defined in

sigma/src/types.ts:121


once()

once<Event>(type, listener): this

Type Parameters

Event extends "updated"

Parameters

type: Event

listener: CameraEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.once

Defined in

sigma/src/types.ts:122


prependListener()

prependListener<Event>(type, listener): this

Type Parameters

Event extends "updated"

Parameters

type: Event

listener: CameraEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.prependListener

Defined in

sigma/src/types.ts:123


prependOnceListener()

prependOnceListener<Event>(type, listener): this

Type Parameters

Event extends "updated"

Parameters

type: Event

listener: CameraEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.prependOnceListener

Defined in

sigma/src/types.ts:124


rawListeners()

rawListeners<Event>(type): CameraEvents[Event][]

Type Parameters

Event extends "updated"

Parameters

type: Event

Returns

CameraEvents[Event][]

Inherited from

TypedEventEmitter.rawListeners

Defined in

sigma/src/types.ts:130


removeAllListeners()

removeAllListeners<Event>(type?): this

Type Parameters

Event extends "updated"

Parameters

type?: Event

Returns

this

Inherited from

TypedEventEmitter.removeAllListeners

Defined in

sigma/src/types.ts:127


removeListener()

removeListener<Event>(type, listener): this

Type Parameters

Event extends "updated"

Parameters

type: Event

listener: CameraEvents[Event]

Returns

this

Inherited from

TypedEventEmitter.removeListener

Defined in

sigma/src/types.ts:125


setMaxListeners()

setMaxListeners(n): this

Parameters

n: number

Returns

this

Inherited from

TypedEventEmitter.setMaxListeners

Defined in

sigma/src/types.ts:117


setState()

setState(state): this

Method used to set the camera's state.

Parameters

state: Partial<CameraState>

Returns

this

Defined in

sigma/src/core/camera.ts:144


updateState()

updateState(updater): this

Method used to update the camera's state using a function.

Parameters

updater

Returns

this

Defined in

sigma/src/core/camera.ts:165


validateState()

validateState(state): Partial<CameraState>

Method used to check various things to return a legit state candidate.

Parameters

state: Partial<CameraState>

Returns

Partial<CameraState>

Defined in

sigma/src/core/camera.ts:124


from()

static from(state): Camera

Static method used to create a Camera object with a given state.

Parameters

state: CameraState

Returns

Camera

Defined in

sigma/src/core/camera.ts:55