UNPKG

@helpwave/hightide

Version:

helpwave's component and theming library

26 lines (24 loc) 965 B
/** * 1 is forwards * * -1 is backwards */ type Direction = 1 | -1; declare class LoopingArrayCalculator { length: number; isLooping: boolean; allowedOverScroll: number; constructor(length: number, isLooping?: boolean, allowedOverScroll?: number); getCorrectedPosition(position: number): number; static withoutOffset(position: number): number; static getOffset(position: number): number; /** * @return absolute distance forwards or Infinity when the target cannot be reached (only possible when not isLooping) */ getDistanceDirectional(position: number, target: number, direction: Direction): number; getDistanceForward(position: number, target: number): number; getDistanceBackward(position: number, target: number): number; getDistance(position: number, target: number): number; getBestDirection(position: number, target: number): Direction; } export { type Direction, LoopingArrayCalculator };