summaryrefslogtreecommitdiff
path: root/src/audio/audio.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-05 22:08:30 +0100
committerskal <pascal.massimino@gmail.com>2026-02-05 22:08:30 +0100
commit4cbea130aca50bd1a4f114ed6a5170cd0dd00d17 (patch)
treea36b579e618fccd0b08c6e664af35fe15390d1ec /src/audio/audio.cc
parentf414d6800e7894468ff4ebcd39cc2ed0195fedaf (diff)
fix(timeline-editor): Fix effect drag jump bug and left handle constraint
CRITICAL BUG FIX: Effect Start Time Jumping Root Cause: Line 788: const currentLeft = parseFloat(e.target.style.left) || 0; Problem: e.target is what was CLICKED, not what has the listener - Clicking effect div itself: e.target = effectDiv ✓ - Clicking <small> text inside: e.target = <small> ✗ - If e.target is <small>, it has no style.left property - parseFloat(undefined) returns NaN, || 0 gives 0 - Wrong offset calculation → effect jumps on click! The Fix: Use e.currentTarget instead of e.target - currentTarget = element with the event listener (always effectDiv) - target = element that was actually clicked (could be child) OLD: const currentLeft = parseFloat(e.target.style.left) || 0; NEW: const currentLeft = parseFloat(e.currentTarget.style.left) || 0; Why This Caused Intermittent Jumping: - Click on effect body (not text) → e.target = effectDiv → works fine - Click on effect text <small> → e.target = <small> → jumps! - Appears random because depends on WHERE user clicks Bug Fix #2: Left Handle Can Extend Past Sequence Start Problem: Math.max(0, ...) prevented negative effect start times - Right handle could extend sequence rightward ✓ - Left handle COULDN'T extend sequence leftward ✗ - Inconsistent behavior The Fix: Remove Math.max(0, ...) constraint Allow negative effect start times OLD: effect.startTime = Math.max(0, Math.min(..., effect.endTime - 0.1)); NEW: effect.startTime = Math.min(newStartTime, effect.endTime - 0.1); How It Works Now: 1. Drag left handle past sequence start 2. effect.startTime becomes negative (e.g., -2.0) 3. renderTimeline() calculates sequence bounds: seqVisualStart = seq.startTime + min(effect.startTime) = 10.0 + (-2.0) = 8.0 4. Sequence box extends leftward automatically! Example: Sequence at t=10s with effect [0.0, 5.0] Drag left handle to t=8s: - effect.startTime = 8.0 - 10.0 = -2.0 (relative) - Sequence visual start = 10.0 + (-2.0) = 8.0 (absolute) - Sequence box now starts at 8.0s ✓ Technical Details: - e.currentTarget: Element that addEventListener was called on - e.target: Deepest element that triggered the event - Effect innerHTML has children: <handle><small><handle> - Clicking text triggers event but e.target is <small>, not effectDiv - This is a classic event delegation bug Result: Both dragging and handles now work correctly!
Diffstat (limited to 'src/audio/audio.cc')
0 files changed, 0 insertions, 0 deletions