Skip to content

Commit c228aa5

Browse files
committed
fix: ui tweaks
1 parent 3807387 commit c228aa5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

package/src/components/ProgressControl/WaveProgressBar.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export const WaveProgressBar = React.memo(
100100
);
101101
const eachWaveformWidth = WAVEFORM_WIDTH + WAVEFORM_GAP;
102102
const fullWidth = (amplitudesCount - 1) * eachWaveformWidth;
103+
const maxThumbTranslateX = Math.max(fullWidth - eachWaveformWidth, 0);
103104
const maxProgressWidth = fullWidth + WAVEFORM_WIDTH;
104105
const dragStartProgress = useSharedValue(0);
105106
const isDragging = useSharedValue(false);
@@ -217,9 +218,16 @@ export const WaveProgressBar = React.memo(
217218
const thumbStyles = useAnimatedStyle(
218219
() => ({
219220
position: 'absolute',
220-
transform: [{ translateX: clampProgress(visualProgress.value) * fullWidth }],
221+
transform: [
222+
{
223+
translateX: Math.min(
224+
clampProgress(visualProgress.value) * fullWidth,
225+
maxThumbTranslateX,
226+
),
227+
},
228+
],
221229
}),
222-
[fullWidth],
230+
[fullWidth, maxThumbTranslateX],
223231
);
224232

225233
return (

0 commit comments

Comments
 (0)