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

Function getVerticalScrollDirection

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

* Gets whether the vertical auto-scroll direction of a node. * @param clientRect Dimensions of the node. * @param pointerY Position of the user's pointer along the y axis.

(clientRect: DOMRect, pointerY: number)

Source from the content-addressed store, hash-verified

808 * @param pointerY Position of the user's pointer along the y axis.
809 */
810function getVerticalScrollDirection(clientRect: DOMRect, pointerY: number) {
811 const {top, bottom, height} = clientRect;
812 const yThreshold = height * SCROLL_PROXIMITY_THRESHOLD;
813
814 if (pointerY >= top - yThreshold && pointerY <= top + yThreshold) {
815 return AutoScrollVerticalDirection.UP;
816 } else if (pointerY >= bottom - yThreshold && pointerY <= bottom + yThreshold) {
817 return AutoScrollVerticalDirection.DOWN;
818 }
819
820 return AutoScrollVerticalDirection.NONE;
821}
822
823/**
824 * Gets whether the horizontal auto-scroll direction of a node.

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected