Function
getOffset
(
element: HTMLElement,
reverse?: boolean,
orientation: Orientation = 'horizontal'
)
Source from the content-addressed store, hash-verified
| 13 | import {Orientation} from '@react-types/shared'; |
| 14 | |
| 15 | export function getOffset( |
| 16 | element: HTMLElement, |
| 17 | reverse?: boolean, |
| 18 | orientation: Orientation = 'horizontal' |
| 19 | ): number { |
| 20 | let rect = element.getBoundingClientRect(); |
| 21 | if (reverse) { |
| 22 | return orientation === 'horizontal' ? rect.right : rect.bottom; |
| 23 | } |
| 24 | return orientation === 'horizontal' ? rect.left : rect.top; |
| 25 | } |
Tested by
no test coverage detected