resolveSnap
Picks the detent to settle on when a drag ends.
This is a function exported by @mapcairn/core, checked against version 0.2.0.
Signature
import { resolveSnap } from "@mapcairn/core";
function resolveSnap(input: {
heights: DetentHeights;
currentHeight: number;
velocityPxPerSecond: number;
}): SheetDetent;
Parameters
input({ heights: DetentHeights; currentHeight: number; velocityPxPerSecond: number; }): The fields, by name:currentHeight: The sheet's visible height at release.velocityPxPerSecond: Positive when the sheet is expanding.
Returns
SheetDetent
Remarks
A fast fling (faster than SHEET_FLING_VELOCITY) moves one
detent from the nearest one, in the fling's direction. Anything slower
projects 0.15 seconds of momentum and snaps to the
nearest detent to that point. Exact ties go to the smaller detent.