Class: Camera
sigma/src.Camera
Camera class
Hierarchy
-
TypedEventEmitter
<CameraEvents
>↳
Camera
Implements
CameraState
Constructors
constructor
• new Camera(): Camera
Returns
Overrides
TypedEventEmitter<CameraEvents>.constructor
Defined in
Properties
angle
• angle: number
= 0
Implementation of
CameraState.angle
Defined in
animationCallback
• Optional
animationCallback: () => void
Type declaration
▸ (): void
Returns
void
Defined in
enabled
• Private
enabled: boolean
= true
Defined in
maxRatio
• maxRatio: null
| number
= null
Defined in
minRatio
• minRatio: null
| number
= null
Defined in
nextFrame
• Private
nextFrame: null
| number
= null
Defined in
previousState
• Private
previousState: null
| CameraState
= null
Defined in
ratio
• ratio: number
= 1
Implementation of
CameraState.ratio
Defined in
rawEmitter
• rawEmitter: EventEmitter
<DefaultEventMap
>
Inherited from
TypedEventEmitter.rawEmitter
Defined in
x
• x: number
= 0.5
Implementation of
CameraState.x
Defined in
y
• y: number
= 0.5
Implementation of
CameraState.y
Defined in
Methods
addListener
▸ addListener<Event
>(type
, listener
): this
Type parameters
Name | Type |
---|---|
Event | extends "updated" |
Parameters
Name | Type |
---|---|
type | Event |
listener | CameraEvents [Event ] |
Returns
this
Inherited from
TypedEventEmitter.addListener
Defined in
animate
▸ animate(state
, opts?
, callback?
): void
Method used to animate the camera.
Parameters
Name | Type | Description |
---|---|---|
state | Partial <CameraState > | State to reach eventually. |
opts? | Partial <AnimateOptions > | Options: |
callback? | () => void | Callback |
Returns
void
Defined in
animatedReset
▸ animatedReset(options?
): void
Method used to reset the camera.
Parameters
Name | Type | Description |
---|---|---|
options? | Partial <AnimateOptions > | Options. |
Returns
void
Defined in
animatedUnzoom
▸ animatedUnzoom(factorOrOptions?
): void
Method used to unzoom the camera.
Parameters
Name | Type | Description |
---|---|---|
factorOrOptions? | number | Partial <AnimateOptions > & { factor? : number } | Factor or options. |
Returns
void
Defined in
animatedZoom
▸ animatedZoom(factorOrOptions?
): void
Method used to zoom the camera.
Parameters
Name | Type | Description |
---|---|---|
factorOrOptions? | number | Partial <AnimateOptions > & { factor? : number } | Factor or options. |
Returns
void
Defined in
copy
▸ copy(): Camera
Returns a new Camera instance, with the same state as the current camera.
Returns
Defined in
disable
▸ disable(): this
Method used to disable the camera.
Returns
this
Defined in
emit
▸ emit<Event
>(type
, ...args
): boolean
Type parameters
Name | Type |
---|---|
Event | extends "updated" |
Parameters
Name | Type |
---|---|
type | Event |
...args | Parameters <CameraEvents [Event ]> |
Returns
boolean
Inherited from
TypedEventEmitter.emit
Defined in
enable
▸ enable(): this
Method used to enable the camera.
Returns
this
Defined in
eventNames
▸ eventNames<Event
>(): Event
[]
Type parameters
Name | Type |
---|---|
Event | extends "updated" |
Returns
Event
[]
Inherited from
TypedEventEmitter.eventNames
Defined in
getBoundedRatio
▸ getBoundedRatio(ratio
): number
Method used to check minRatio and maxRatio values.
Parameters
Name | Type |
---|---|
ratio | number |
Returns
number
Defined in
getMaxListeners
▸ getMaxListeners(): number
Returns
number
Inherited from
TypedEventEmitter.getMaxListeners
Defined in
getPreviousState
▸ getPreviousState(): null
| CameraState
Method used to retrieve the camera's previous state.
Returns
null
| CameraState
Defined in
getState
▸ getState(): CameraState
Method used to retrieve the camera's current state.
Returns
CameraState
Defined in
hasState
▸ hasState(state
): boolean
Method used to check whether the camera has the given state.
Parameters
Name | Type |
---|---|
state | CameraState |
Returns
boolean
Defined in
isAnimated
▸ isAnimated(): boolean
Method used to check whether the camera is currently being animated.
Returns
boolean
Defined in
listenerCount
▸ listenerCount<Event
>(type
): number
Type parameters
Name | Type |
---|---|
Event | extends "updated" |
Parameters
Name | Type |
---|---|
type | Event |
Returns
number
Inherited from
TypedEventEmitter.listenerCount
Defined in
listeners
▸ listeners<Event
>(type
): CameraEvents
[Event
][]
Type parameters
Name | Type |
---|---|
Event | extends "updated" |
Parameters
Name | Type |
---|---|
type | Event |
Returns
CameraEvents
[Event
][]
Inherited from
TypedEventEmitter.listeners
Defined in
off
▸ off<Event
>(type
, listener
): this
Type parameters
Name | Type |
---|---|
Event | extends "updated" |
Parameters
Name | Type |
---|---|
type | Event |
listener | CameraEvents [Event ] |
Returns
this
Inherited from
TypedEventEmitter.off
Defined in
on
▸ on<Event
>(type
, listener
): this
Type parameters
Name | Type |
---|---|
Event | extends "updated" |
Parameters
Name | Type |
---|---|
type | Event |
listener | CameraEvents [Event ] |
Returns
this
Inherited from
TypedEventEmitter.on
Defined in
once
▸ once<Event
>(type
, listener
): this
Type parameters
Name | Type |
---|---|
Event | extends "updated" |
Parameters
Name | Type |
---|---|
type | Event |
listener | CameraEvents [Event ] |
Returns
this
Inherited from
TypedEventEmitter.once
Defined in
prependListener
▸ prependListener<Event
>(type
, listener
): this
Type parameters
Name | Type |
---|---|
Event | extends "updated" |
Parameters
Name | Type |
---|---|
type | Event |
listener | CameraEvents [Event ] |
Returns
this
Inherited from
TypedEventEmitter.prependListener
Defined in
prependOnceListener
▸ prependOnceListener<Event
>(type
, listener
): this
Type parameters
Name | Type |
---|---|
Event | extends "updated" |
Parameters
Name | Type |
---|---|
type | Event |
listener | CameraEvents [Event ] |
Returns
this
Inherited from
TypedEventEmitter.prependOnceListener
Defined in
rawListeners
▸ rawListeners<Event
>(type
): CameraEvents
[Event
][]
Type parameters
Name | Type |
---|---|
Event | extends "updated" |
Parameters
Name | Type |
---|---|
type | Event |
Returns
CameraEvents
[Event
][]
Inherited from
TypedEventEmitter.rawListeners
Defined in
removeAllListeners
▸ removeAllListeners<Event
>(type?
): this
Type parameters
Name | Type |
---|---|
Event | extends "updated" |
Parameters
Name | Type |
---|---|
type? | Event |
Returns
this
Inherited from
TypedEventEmitter.removeAllListeners
Defined in
removeListener
▸ removeListener<Event
>(type
, listener
): this
Type parameters
Name | Type |
---|---|
Event | extends "updated" |
Parameters
Name | Type |
---|---|
type | Event |
listener | CameraEvents [Event ] |
Returns
this
Inherited from
TypedEventEmitter.removeListener
Defined in
setMaxListeners
▸ setMaxListeners(n
): this
Parameters
Name | Type |
---|---|
n | number |
Returns
this
Inherited from
TypedEventEmitter.setMaxListeners
Defined in
setState
▸ setState(state
): this
Method used to set the camera's state.
Parameters
Name | Type | Description |
---|---|---|
state | Partial <CameraState > | New state. |
Returns
this
Defined in
updateState
▸ updateState(updater
): this
Method used to update the camera's state using a function.
Parameters
Name | Type | Description |
---|---|---|
updater | (state : CameraState ) => Partial <CameraState > | Updated function taking current state and returning next state. |
Returns
this
Defined in
validateState
▸ validateState(state
): Partial
<CameraState
>
Method used to check various things to return a legit state candidate.
Parameters
Name | Type |
---|---|
state | Partial <CameraState > |
Returns
Partial
<CameraState
>
Defined in
from
▸ from(state
): Camera
Static method used to create a Camera object with a given state.
Parameters
Name | Type |
---|---|
state | CameraState |