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

Function onMove

packages/react-aria/src/color/useColorWheel.ts:98–113  ·  view source on GitHub ↗
({deltaX, deltaY, pointerType, shiftKey})

Source from the content-addressed store, hash-verified

96 state.setDragging(true);
97 },
98 onMove({deltaX, deltaY, pointerType, shiftKey}) {
99 if (currentPosition.current == null) {
100 currentPosition.current = state.getThumbPosition(thumbRadius);
101 }
102 currentPosition.current.x += deltaX;
103 currentPosition.current.y += deltaY;
104 if (pointerType === 'keyboard') {
105 if (deltaX > 0 || deltaY < 0) {
106 state.increment(shiftKey ? state.pageStep : state.step);
107 } else if (deltaX < 0 || deltaY > 0) {
108 state.decrement(shiftKey ? state.pageStep : state.step);
109 }
110 } else {
111 state.setHueFromPoint(currentPosition.current.x, currentPosition.current.y, thumbRadius);
112 }
113 },
114 onMoveEnd() {
115 isOnTrack.current = false;
116 state.setDragging(false);

Callers

nothing calls this directly

Calls 4

setHueFromPointMethod · 0.80
getThumbPositionMethod · 0.65
incrementMethod · 0.65
decrementMethod · 0.65

Tested by

no test coverage detected