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

Function onMouseDown

packages/react-aria/src/utils/useDrag1D.ts:115–125  ·  view source on GitHub ↗
(e: React.MouseEvent<HTMLElement>)

Source from the content-addressed store, hash-verified

113 };
114
115 let onMouseDown = (e: React.MouseEvent<HTMLElement>) => {
116 const target = e.currentTarget;
117 // If we're already handling dragging on a descendant with useDrag1D, then
118 // we don't want to handle the drag motion on this target as well.
119 if (draggingElements.some(elt => nodeContains(target, elt))) {
120 return;
121 }
122 draggingElements.push(target);
123 window.addEventListener('mousemove', onMouseDragged, false);
124 window.addEventListener('mouseup', onMouseUp, false);
125 };
126
127 let onMouseEnter = () => {
128 if (onHover) {

Callers

nothing calls this directly

Calls 3

nodeContainsFunction · 0.90
pushMethod · 0.80
addEventListenerMethod · 0.80

Tested by

no test coverage detected