try adding touch controls

main
btahir89 12 months ago
parent 2528ce68e4
commit 3a6a3e562c

@ -70,7 +70,21 @@ const PlaybackControls: React.FC<PlaybackControlsProps> = ({
step={0.01}
value={volume}
onChange={(e) => setVolume(parseFloat(e.target.value))}
className="w-full cursor-pointer accent-[var(--lofi-accent)] rounded-lg bg-[var(--lofi-card-hover)]"
onTouchStart={(e) => {
// Prevent default touch behavior
e.stopPropagation()
}}
onTouchMove={(e) => {
// Get the touch position relative to the input
const touch = e.touches[0]
const input = e.target as HTMLInputElement
const rect = input.getBoundingClientRect()
const pos = (touch.clientX - rect.left) / rect.width
// Clamp the value between 0 and 1
const newVolume = Math.max(0, Math.min(1, pos))
setVolume(newVolume)
}}
className="w-full cursor-pointer accent-[var(--lofi-accent)] rounded-lg bg-[var(--lofi-card-hover)] touch-none"
/>
</div>
</div>

Loading…
Cancel
Save