From cabef460cb4560e26b4e5f8bfaa97e8b71622c5a Mon Sep 17 00:00:00 2001 From: skal Date: Thu, 12 Feb 2026 13:28:00 +0100 Subject: 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 --- tools/timeline_editor/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tools') 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; -- cgit v1.2.3