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:42

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:40


enabledRotation

enabledRotation: 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:109


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:115


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:169

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:170


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:272


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:256


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:240


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:287


disable()

disable(): this

Method used to disable the camera.

Returns

this

Defined in

sigma/src/core/camera.ts:68


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:114


enable()

enable(): this

Method used to enable the camera.

Returns

this

Defined in

sigma/src/core/camera.ts:60


eventNames()

eventNames<Event>(): Event[]

Type Parameters

Event extends "updated"

Returns

Event[]

Inherited from

TypedEventEmitter.eventNames

Defined in

sigma/src/types.ts:111


getBoundedRatio()

getBoundedRatio(ratio): number

Method used to check minRatio and maxRatio values.

Parameters

ratio: number

Returns

number

Defined in

sigma/src/core/camera.ts:111


getMaxListeners()

getMaxListeners(): number

Returns

number

Inherited from

TypedEventEmitter.getMaxListeners

Defined in

sigma/src/types.ts:113


getPreviousState()

getPreviousState(): null | CameraState

Method used to retrieve the camera's previous state.

Returns

null | CameraState

Defined in

sigma/src/core/camera.ts:95


getState()

getState(): CameraState

Method used to retrieve the camera's current state.

Returns

CameraState

Defined in

sigma/src/core/camera.ts:76


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:88


isAnimated()

isAnimated(): boolean

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

Returns

boolean

Defined in

sigma/src/core/camera.ts:133


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:124


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:123


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:121


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:116


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:117


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:118


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:119


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:125


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:122


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:120


setMaxListeners()

setMaxListeners(n): this

Parameters

n: number

Returns

this

Inherited from

TypedEventEmitter.setMaxListeners

Defined in

sigma/src/types.ts:112


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:140


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:161


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:121


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:52