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