Primitives / foldkit-primitives/dom

edgeScroller

function · packages/primitives/src/dom/edge-scroller.ts:65

function edgeScroller(
  element: Element,
  options: EdgeScroll,
  onScrolled: () => void,
): {
  readonly move: (x: number, y: number) => void
  readonly stop: () => void
}

Scrolls while move was last given a point near an edge of the nearest ancestor of element that can scroll that way, one frame at a time, and calls onScrolled after each so the caller measures again under the still pointer. The frame loop runs only while something scrolls; move starts it, and stop ends it.