API reference: @salmonui/core/virtual
ScrollMappinginterface
import type { ScrollMapping } from '@salmonui/core/virtual';interface ScrollMapping {
readonly compressed: boolean;
readonly scrollHeight: number;
readonly totalHeight: number;
readonly ratio: number;
toVirtual(scrollTop: number): number;
toPhysical(virtualTop: number): number;
segmentAt(virtualTop: number, estimatedRowHeight: number): {
index: number;
count: number;
rowsPerSegment: number;
} | null;
}
Maps between the physical scroll offset of the scroll container and the
virtual offset of the row model. Below maxScrollHeight the mapping is the
identity. Above it the physical scroll height is capped and the offset is
mapped linearly (scroll height compression), so 10M+ rows stay reachable in
browsers that cap element heights (~17.9M px Firefox, ~33.5M px Chromium).
| Name | Signature | Description |
|---|---|---|
compressed | readonly compressed: boolean; | |
scrollHeight | readonly scrollHeight: number; | Physical height of the scrollable content. |
totalHeight | readonly totalHeight: number; | |
ratio | readonly ratio: number; | Virtual px per physical px (1 when not compressed). |
toVirtual | toVirtual(scrollTop: number): number; | |
toPhysical | toPhysical(virtualTop: number): number; | |
segmentAt | segmentAt(virtualTop: number, estimatedRowHeight: number): {
index: number;
count: number;
rowsPerSegment: number;
} | null; | Deterministic segment of a virtual offset; null when not compressed. |