({deltaX, deltaY})
| 83 | currentPosition.current = null; |
| 84 | }, |
| 85 | onMove({deltaX, deltaY}) { |
| 86 | if (!trackRef.current) { |
| 87 | return; |
| 88 | } |
| 89 | let {height, width} = trackRef.current.getBoundingClientRect(); |
| 90 | let size = isVertical ? height : width; |
| 91 | |
| 92 | if (currentPosition.current == null && realTimeTrackDraggingIndex.current != null) { |
| 93 | currentPosition.current = state.getThumbPercent(realTimeTrackDraggingIndex.current) * size; |
| 94 | } |
| 95 | |
| 96 | let delta = isVertical ? deltaY : deltaX; |
| 97 | if (isVertical || reverseX) { |
| 98 | delta = -delta; |
| 99 | } |
| 100 | |
| 101 | currentPosition.current! += delta; |
| 102 | |
| 103 | if (realTimeTrackDraggingIndex.current != null && trackRef.current) { |
| 104 | const percent = clamp(currentPosition.current! / size, 0, 1); |
| 105 | state.setThumbPercent(realTimeTrackDraggingIndex.current, percent); |
| 106 | } |
| 107 | }, |
| 108 | onMoveEnd() { |
| 109 | if (realTimeTrackDraggingIndex.current != null) { |
| 110 | state.setThumbDragging(realTimeTrackDraggingIndex.current, false); |
no test coverage detected