(
inputNodes: readonly (RawSnapshotNode | SnapshotNode)[] | undefined,
edge: ScrollEdge,
target: ScrollEdgeTarget = {},
)
| 31 | const SCROLL_SIGNATURE_RECT_PRECISION = 1; |
| 32 | |
| 33 | function analyzeScrollEdgeState( |
| 34 | inputNodes: readonly (RawSnapshotNode | SnapshotNode)[] | undefined, |
| 35 | edge: ScrollEdge, |
| 36 | target: ScrollEdgeTarget = {}, |
| 37 | ): ScrollEdgeState { |
| 38 | const nodes = ensureSnapshotNodes(inputNodes ?? []); |
| 39 | if (nodes.length === 0) { |
| 40 | return { |
| 41 | canScroll: false, |
| 42 | emptySnapshot: true, |
| 43 | signature: '', |
| 44 | }; |
| 45 | } |
| 46 | |
| 47 | const hiddenHints = deriveMobileSnapshotHiddenContentHints(nodes); |
| 48 | const container = selectScrollContainer(nodes, hiddenHints, edge, target); |
| 49 | const signatureNodes = container ? collectSubtreeNodes(nodes, container.index) : nodes; |
| 50 | const signature = buildScrollStateSignature(signatureNodes); |
| 51 | if (!container) { |
| 52 | return { |
| 53 | canScroll: false, |
| 54 | emptySnapshot: false, |
| 55 | signature, |
| 56 | }; |
| 57 | } |
| 58 | |
| 59 | const canScroll = hasHiddenContentAtEdge(container, hiddenHints.get(container.index), edge); |
| 60 | return { |
| 61 | canScroll, |
| 62 | emptySnapshot: false, |
| 63 | signature, |
| 64 | scope: buildScrollContainerScope(container), |
| 65 | }; |
| 66 | } |
| 67 | |
| 68 | export async function captureScrollEdgeState(params: { |
| 69 | edge: ScrollEdge; |
no test coverage detected