@egjs/flicking
Version:
Everyday 30 million people experience. It's reliable, flexible and extendable carousel.
61 lines (60 loc) • 2.31 kB
TypeScript
import { OnRelease } from "@egjs/axes";
import Panel from "../core/panel/Panel";
import Control, { MoveToPanelParams } from "./Control";
/**
* Options for the {@link StrictControl}
*/
export interface StrictControlOptions {
/** Maximum number of panels that can be moved at a time */
count: number;
}
/**
* A {@link Control} that allows you to select the maximum number of panels to move at a time
* @since 4.2.0
* @public
*/
declare class StrictControl extends Control {
private _count;
private _indexRange;
/**
* Maximum number of panels that can be moved at a time
* @defaultValue 1
*/
get count(): number;
set count(val: StrictControlOptions["count"]);
constructor(options?: Partial<StrictControlOptions>);
/**
* Destroy Control and return to initial state
* @remarks
* This method also resets the index range used for movement constraints.
*/
destroy(): void;
/**
* Update {@link Control.controller | controller}'s state
* @remarks
* StrictControl limits the movement range based on the {@link StrictControlOptions.count | count} option.
* @returns The current instance for method chaining
*/
updateInput(): this;
moveToPanel(panel: Panel, options: MoveToPanelParams): Promise<void>;
/**
* Move {@link Camera} to the given position
* @remarks
* StrictControl restricts movement to panels within the allowed index range based on the count option.
* @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>;
setActive: (newActivePanel: Panel, prevActivePanel: Panel | null, isTrusted: boolean) => void;
/**
* @internal
* @privateRemarks
* Resets the index range to default values.
*/
private _resetIndexRange;
}
export default StrictControl;