fix stupid slider

This commit is contained in:
2026-02-10 00:58:40 -08:00
parent bfae55afa3
commit 892f43381b
6 changed files with 15 additions and 103 deletions

View File

@@ -1,8 +1,6 @@
<script lang="ts">
import { ChevronUp, Disc, X } from "@lucide/svelte";
import { Button } from "$lib/components/ui/button";
import { Disc } from "@lucide/svelte";
import * as Drawer from "$lib/components/ui/drawer";
import { Slider } from "$lib/components/ui/slider";
import { player } from "$lib/player/store.svelte";
import Controls from "./Controls.svelte";
import { getAudioContext } from "./ctx.svelte";
@@ -11,19 +9,6 @@
const audio = getAudioContext();
let open = $state(false);
let sliderValue = $state([0]);
// Sync Audio -> Slider
$effect(() => {
if (Math.abs(sliderValue[0] - audio.currentTime) > 0.1) {
sliderValue = [audio.currentTime];
}
});
function onSeek(v: number[]) {
if (Math.abs(v[0] - audio.currentTime) < 0.1) return;
audio.seek(v[0]);
}
</script>
<div
@@ -109,12 +94,10 @@
<!-- Progress -->
<div class="space-y-2">
<Slider
bind:value={sliderValue}
<input
type="range"
bind:value={audio.currentTime}
max={audio.duration || 100}
step={0.01}
onValueChange={onSeek}
type="multiple"
class="w-full"
/>
<div