Skip to main content
Version: 4.3.1

BoundCamera

class BoundCamera extends Camera

A Camera that set range not to go out of the first/last panel, so it won't show empty spaces before/after the first/last panel

Properties

element

readonlyinherited

The camera(.flicking-camera) element

Type: HTMLElement

position

readonlyinherited

Current position of the camera

Type: number

alignPosition

readonlyinherited

Align position inside the viewport where Panel's alignPosition should be located at

Type: number

offset

readonlyinherited

Position offset, used for the renderOnlyVisible option

Type: number

Default: 0

range

readonlyinherited

A range that Camera's position can reach

Type: object

PROPERTYTYPEDESCRIPTION
minnumberA minimum position
minnumberA maximum position

rangeDiff

readonlyinherited

A difference between Camera's minimum and maximum position that can reach

Type: number

visiblePanels

readonlyinherited

An array of visible panels from the current position

Type: Array<Panel>

visibleRange

readonlyinherited

A range of the visible area from the current position

Type: object

PROPERTYTYPEDESCRIPTION
minnumberA minimum position
minnumberA maximum position

anchorPoints

readonlyinherited

An array of AnchorPoints that Camera can be stopped at

Type: Array<AnchorPoint>

controlParams

readonlyinherited

A current parameters of the Camera for updating AxesController

Type: ControlParams

atEdge

readonlyinherited

A Boolean value indicating whether Camera's over the minimum or maximum position reachable

Type: boolean

size

readonlyinherited

Return the size of the viewport

Type: number

progress

readonlyinherited

Return the camera's position progress from the first panel to last panel
Range is from 0 to last panel's index

Type: number

align

inherited

A value indicating where the alignPosition should be located at inside the viewport element

Type: ALIGN | string | number

Methods

updateRange

Update range of Camera

Returns: this

Throws: FlickingError

NOT_ATTACHED_TO_FLICKING When init is not called before

init

inherited

Initialize Camera

Returns: this

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
flickingFlickingAn instance of Flicking

Throws: FlickingError

VAL_MUST_NOT_NULL If the camera element(.flicking-camera) does not exist inside viewport element

destroy

inherited

Destroy Camera and return to initial state

Returns: void

lookAt

inherited

Move to the given position and apply CSS transform

Returns: this

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
posnumberA new position

Throws: FlickingError

NOT_ATTACHED_TO_FLICKING When init is not called before

getPrevAnchor

inherited

Return a previous AnchorPoint of given AnchorPoint
If it does not exist, return null instead

Returns: AnchorPoint | null

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
anchorAnchorPointA reference AnchorPoint

getNextAnchor

inherited

Return a next AnchorPoint of given AnchorPoint
If it does not exist, return null instead

Returns: AnchorPoint | null

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
anchorAnchorPointA reference AnchorPoint

getProgressInPanel

inherited

Return the camera's position progress in the panel below
Value is from 0 to 1 when the camera's inside panel
Value can be lower than 0 or bigger than 1 when it's in the margin area

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
panelPanel

findAnchorIncludePosition

inherited

Return AnchorPoint that includes given position
If there's no AnchorPoint that includes the given position, return null instead

Returns: AnchorPoint | null

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
positionnumberA position to check

findNearestAnchor

inherited

Return AnchorPoint nearest to given position
If there're no AnchorPoints, return null instead

Returns: AnchorPoint | null

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
positionnumberA position to check

findActiveAnchor

inherited

Return AnchorPoint that matches Flicking#currentPanel

Returns: AnchorPoint | null

clampToReachablePosition

inherited

Clamp the given position between camera's range

Returns: number

  • A clamped position
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
positionnumberA position to clamp

canReach

inherited

Check whether the given panel is inside of the Camera's range

Returns: boolean

  • Whether the panel's inside Camera's range
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
panelPanelAn instance of Panel to check

canSee

inherited

Check whether the given panel element is visible at the current position

Returns: boolean

  • Whether the panel element is visible at the current position
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
panelPanelAn instance of Panel to check

updateAlignPos

inherited

Update Camera's alignPosition

Returns: this

updateAnchors

inherited

Update Camera's anchorPoints

Returns: this

Throws: FlickingError

NOT_ATTACHED_TO_FLICKING When init is not called before

updateAdaptiveHeight

inherited

Update Viewport's height to active panel's height

Returns: this

Throws: FlickingError

NOT_ATTACHED_TO_FLICKING When init is not called before

resetNeedPanelHistory

inherited

Reset the history of needPanel events so it can be triggered again

Returns: this