@egjs/flicking
Version:
Everyday 30 million people experience. It's reliable, flexible and extendable carousel.
45 lines (44 loc) • 1.89 kB
TypeScript
import { OnRelease } from "@egjs/axes";
import Control from "./Control";
/**
* Options for the {@link FreeControl}
*/
export interface FreeControlOptions {
/** Make scroll animation to stop at the start/end of the scroll area, not going out the bounce area */
stopAtEdge: boolean;
}
/**
* A {@link Control} that can be scrolled freely without alignment
* @public
*/
declare class FreeControl extends Control {
private _stopAtEdge;
/**
* Make scroll animation to stop at the start/end of the scroll area, not going out the bounce area
* @defaultValue true
*/
get stopAtEdge(): boolean;
set stopAtEdge(val: FreeControlOptions["stopAtEdge"]);
constructor(options?: Partial<FreeControlOptions>);
/**
* Update position after resizing
* @remarks
* Unlike the base Control, FreeControl preserves the progress within the panel instead of snapping to the panel position.
* @param progressInPanel - Previous camera's progress in active panel before resize
* @throws {@link InitializationErrors}
*/
updatePosition(progressInPanel: number): void;
/**
* Move {@link Camera} to the given position
* @remarks
* Unlike SnapControl, FreeControl moves to the exact position without snapping to panel boundaries.
* @param position - The target position to move
* @param duration - Duration of the panel movement animation (unit: ms)
* @param axesEvent - {@link https://naver.github.io/egjs-axes/docs/api/Axes#event-release | release} event of {@link https://naver.github.io/egjs-axes/ | Axes}
* @fires {@link MovementEvents}
* @throws {@link MovementErrors}
* @returns A Promise which will be resolved after reaching the target position
*/
moveToPosition(position: number, duration: number, axesEvent?: OnRelease): Promise<void>;
}
export default FreeControl;