vue-timeline-chart
Version:
Vue3 Timeline Chart component
24 lines (23 loc) • 961 B
TypeScript
import type { TimelineMomentumOptions } from '../types/timeline.ts';
interface UseMomentumOptions {
/**
* Applies one pan step (in px) during the fling. Return `false` when the
* viewport can't move any further so the fling stops (e.g. at a boundary).
*/
onFling: (deltaX: number) => boolean | void;
/** Resolved options, read fresh on each release. */
config: () => TimelineMomentumOptions;
}
/**
* Momentum ("fling") panning for touch drags: tracks finger velocity during a
* single-finger drag and, on release, keeps panning with an exponential decay
* until it slows to a stop or hits a boundary. Rapid same-direction flings
* compound onto the leftover momentum (like a flywheel).
*/
export declare function useMomentum({ onFling, config }: UseMomentumOptions): {
track: (x: number, t: number) => void;
reset: (x: number, t: number) => void;
release: (t: number) => void;
stop: () => void;
};
export {};