* Gets whether the horizontal auto-scroll direction of a node. * @param clientRect Dimensions of the node. * @param pointerX Position of the user's pointer along the x axis.
(clientRect: DOMRect, pointerX: number)
| 826 | * @param pointerX Position of the user's pointer along the x axis. |
| 827 | */ |
| 828 | function getHorizontalScrollDirection(clientRect: DOMRect, pointerX: number) { |
| 829 | const {left, right, width} = clientRect; |
| 830 | const xThreshold = width * SCROLL_PROXIMITY_THRESHOLD; |
| 831 | |
| 832 | if (pointerX >= left - xThreshold && pointerX <= left + xThreshold) { |
| 833 | return AutoScrollHorizontalDirection.LEFT; |
| 834 | } else if (pointerX >= right - xThreshold && pointerX <= right + xThreshold) { |
| 835 | return AutoScrollHorizontalDirection.RIGHT; |
| 836 | } |
| 837 | |
| 838 | return AutoScrollHorizontalDirection.NONE; |
| 839 | } |
| 840 | |
| 841 | /** |
| 842 | * Gets the directions in which an element node should be scrolled, |
no outgoing calls
no test coverage detected