MCPcopy Create free account
hub / github.com/adobe/react-spectrum / setScrollLeft

Function setScrollLeft

packages/react-aria/src/virtualizer/utils.ts:86–103  ·  view source on GitHub ↗
(node: Element, direction: Direction, scrollLeft: number)

Source from the content-addressed store, hash-verified

84}
85
86export function setScrollLeft(node: Element, direction: Direction, scrollLeft: number): void {
87 if (direction === 'rtl') {
88 switch (getRTLOffsetType()) {
89 case 'negative':
90 scrollLeft = -scrollLeft;
91 break;
92 case 'positive-ascending':
93 break;
94 default: {
95 const {clientWidth, scrollWidth} = node;
96 scrollLeft = scrollWidth - clientWidth - scrollLeft;
97 break;
98 }
99 }
100 }
101
102 node.scrollLeft = scrollLeft;
103}

Callers 1

onVisibleRectChangeFunction · 0.90

Calls 1

getRTLOffsetTypeFunction · 0.85

Tested by

no test coverage detected