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

Function onMouseMove

packages/react-aria/src/interactions/useMove.ts:108–121  ·  view source on GitHub ↗
(e: MouseEvent)

Source from the content-addressed store, hash-verified

106
107 if (typeof PointerEvent === 'undefined' && process.env.NODE_ENV === 'test') {
108 let onMouseMove = (e: MouseEvent) => {
109 if (e.button === 0) {
110 // Should be safe to use the useEffectEvent because these are equivalent https://github.com/reactjs/react.dev/issues/8075#issuecomment-3400179389
111 // However, the compiler is not smart enough to know that. As such, this whole file must be manually optimised as the compiler will bail.
112 //
113 moveEvent(
114 e,
115 'mouse',
116 e.pageX - (state.current.lastPosition?.pageX ?? 0),
117 e.pageY - (state.current.lastPosition?.pageY ?? 0)
118 );
119 state.current.lastPosition = {pageX: e.pageX, pageY: e.pageY};
120 }
121 };
122 let onMouseUp = (e: MouseEvent) => {
123 if (e.button === 0) {
124 // oxlint-disable-next-line react/react-compiler

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected