Skip to main content
Version: 4.12.0

StrictControl

class StrictControl extends Control

A Control that allow you to select the maximum number of panels to move at a time

constructor

new StrictControl()
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
Partial<StrictControlOptions>✔️{}

Properties

count

Maximum number of panels that can be moved at a time

Type: number

Default: 1

controller

readonlyinherited

A controller that handles the @egjs/axes events

Type: AxesController

activeIndex

readonlyinherited

Index number of the currentPanel

Type: number

Default: 0

activePanel

readonlyinherited

An active panel

Type: Panel | null

animating

readonlyinherited

Whether Flicking's animating

Type: boolean

holding

readonlyinherited

Whether user is clicking or touching

Type: boolean

Methods

destroy

Destroy Control and return to initial state

Returns: void

updateInput

Update controller's state

Returns: this

moveToPosition

Move Camera to the given position

Returns: Promise<void>

  • A Promise which will be resolved after reaching the target position

Emits: Flicking#event:moveStart, Flicking#event:move, Flicking#event:moveEnd, Flicking#event:willChange, Flicking#event:changed, Flicking#event:willRestore, Flicking#event:restored, Flicking#event:needPanel, Flicking#event:visibleChange, Flicking#event:reachEdge

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
positionnumberThe target position to move
durationnumberDuration of the panel movement animation (unit: ms).
axesEventobject✔️release event of Axes

Throws: FlickingError

|code|condition|
|---|---|
|POSITION_NOT_REACHABLE|When the given panel is already removed or not in the Camera's range|
|NOT_ATTACHED_TO_FLICKING|When init is not called before|
|ANIMATION_INTERRUPTED|When the animation is interrupted by user input|
|STOP_CALLED_BY_USER|When the animation is interrupted by user input|

init

inherited

Initialize Control

Returns: this

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
flickingFlickingAn instance of Flicking

enable

inherited

Enable input from the user (mouse/touch)

Returns: this

disable

inherited

Disable input from the user (mouse/touch)

Returns: this

release

inherited

Releases ongoing user input (mouse/touch)

Returns: this

updateAnimation

inherited

Change the destination and duration of the animation currently playing

Returns: this

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
panelPanelThe target panel to move
durationnumber✔️Duration of the animation (unit: ms)
directionDIRECTION✔️Direction to move, only available in the circular mode

Throws: FlickingError

POSITION_NOT_REACHABLE When the given panel is already removed or not in the Camera's range

stopAnimation

inherited

Stops the animation currently playing

Returns: this

updatePosition

inherited

Update position after resizing

Returns: Promise<void>

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
progressInPanelnumberPrevious camera's progress in active panel before resize

Throws: FlickingError

NOT_ATTACHED_TO_FLICKING When init is not called before

resetActive

inherited

Reset activePanel to null

Returns: this

moveToPanel

inheritedasync

Move Camera to the given panel

Returns: Promise<void>

  • A Promise which will be resolved after reaching the target panel

Emits: Flicking#event:moveStart, Flicking#event:move, Flicking#event:moveEnd, Flicking#event:willChange, Flicking#event:changed, Flicking#event:willRestore, Flicking#event:restored, Flicking#event:needPanel, Flicking#event:visibleChange, Flicking#event:reachEdge

PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
panelPanelThe target panel to move
optionsobjectAn options object
durationnumberDuration of the animation (unit: ms)
axesEventobject✔️release event of Axes
directionDIRECTION✔️DIRECTION.NONEDirection to move, only available in the circular mode

Throws: FlickingError

|code|condition|
|---|---|
|POSITION_NOT_REACHABLE|When the given panel is already removed or not in the Camera's range|
|NOT_ATTACHED_TO_FLICKING|When init is not called before|
|ANIMATION_INTERRUPTED|When the animation is interrupted by user input|
|STOP_CALLED_BY_USER|When the animation is interrupted by user input|

setActive

inherited
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
newActivePanelPanel
prevActivePanelPanel | null
isTrustedboolean

copy

inherited
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
controlControl