summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-12 13:28:00 +0100
committerskal <pascal.massimino@gmail.com>2026-02-12 13:28:00 +0100
commitcabef460cb4560e26b4e5f8bfaa97e8b71622c5a (patch)
treedc5bf6057888df4cb41b442c2dfb3d5163e40174
parenta27925e8cbe97b3219437608b40432e886782316 (diff)
Timeline editor: fix waveform click position calculation
Read actual canvas offset from style.left instead of assuming scrollLeft. Canvas is positioned with negative left offset, so we subtract it to get correct beat position. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
-rw-r--r--tools/timeline_editor/index.html3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/timeline_editor/index.html b/tools/timeline_editor/index.html
index 402c580..4ea93f2 100644
--- a/tools/timeline_editor/index.html
+++ b/tools/timeline_editor/index.html
@@ -851,7 +851,8 @@
dom.waveformContainer.addEventListener('click', async e => {
if (!state.audioBuffer) return;
const rect = dom.waveformContainer.getBoundingClientRect();
- const clickX = e.clientX - rect.left + dom.timelineContent.scrollLeft;
+ const canvasOffset = parseFloat(dom.waveformCanvas.style.left) || 0;
+ const clickX = e.clientX - rect.left - canvasOffset;
const clickBeats = clickX / state.pixelsPerSecond;
const clickTime = beatsToTime(clickBeats);
const wasPlaying = state.isPlaying;