MCPcopy Create free account
hub / github.com/angular/components / getHorizontalScrollDirection

Function getHorizontalScrollDirection

src/cdk/drag-drop/drop-list-ref.ts:828–839  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

826 * @param pointerX Position of the user's pointer along the x axis.
827 */
828function 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,

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected