UI kit reference
code/editor/find/settle-scroll
import { … } from 'zidane-ui/code/editor'ui/src/code/editor/find/settle-scroll.ts
Functions#
settleScrollFunction#
Scrolls root so the target ends offset px below its top and holds it there while the content
above settles; stops on stillness, after two seconds, or when the user scrolls.
function settleScroll(
root: HTMLElement,
target: () => ScrollTarget,
options?: { offset?: number | ((root: HTMLElement) => number); smooth?: boolean },
): () => voidParameters
| Name | Type | Default | Description |
|---|---|---|---|
| root | HTMLElement | The scroll container. | |
| target | () => ScrollTarget | Read every frame, so it can return a freshly rendered element; | |
| options? | { offset?: number | ((root: HTMLElement) => number); smooth?: boolean } | {} |
|
Returns
() => voidA function that cancels the scroll.
Types#
ScrollTargetType#
Where to go: an element, or an estimated position in the scroll content
(top, in scrollTop terms) for a line that is not rendered yet.
type ScrollTarget = HTMLElement | { top: number } | null | undefined