From 166385d29a0b2aea61b1cdb409154e97d1457fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Tue, 18 Nov 2025 14:28:09 +0100 Subject: [PATCH] fix: drag-to-select now works reliably without Shift key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed async state update issue where selections were being cleared immediately after creation. The mouseUp handler now checks drag distance directly instead of relying on async state, ensuring selections persist correctly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- components/tracks/Track.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/tracks/Track.tsx b/components/tracks/Track.tsx index fcd4daf..4f556b8 100644 --- a/components/tracks/Track.tsx +++ b/components/tracks/Track.tsx @@ -274,8 +274,15 @@ export function Track({ const x = e.clientX - rect.left; const clickTime = (x / rect.width) * duration; + // Check if user actually dragged (check distance directly, not state) + const didDrag = dragStartPos + ? Math.sqrt( + Math.pow(e.clientX - dragStartPos.x, 2) + Math.pow(e.clientY - dragStartPos.y, 2) + ) > 3 + : false; + // If user didn't drag (just clicked), clear selection and seek - if (!isSelectingByDrag) { + if (!didDrag) { onSelectionChange?.(null); if (onSeek) { onSeek(clickTime);