From 18c753cae169171d135e82ac5cfefce4b0e8b5f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Luis=20Monta=C3=B1es?= Date: Thu, 19 Mar 2026 22:35:16 +0100 Subject: [PATCH] Fix waveform: tick-based rendering + always-follow auto-scroll - timeStep increments by 1 per tick (not by simSpeed ms) - waveZoom = pixels per step directly (zoom changes wave width) - Speed control only changes real-time interval between ticks - Auto-scroll always follows latest data regardless of zoom level Co-Authored-By: Claude Opus 4.6 --- js/waveform.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/js/waveform.js b/js/waveform.js index 200a611..6bb163e 100644 --- a/js/waveform.js +++ b/js/waveform.js @@ -132,9 +132,8 @@ export function drawWaveforms() { // Visible width in steps const visibleSteps = wc.width / pxPerStep; - // Auto-scroll to show latest (only if near the end) - const isNearEnd = state.waveScroll >= state.timeStep - visibleSteps - 2; - if (totalPx > wc.width && isNearEnd) { + // Auto-scroll: always follow the latest data + if (totalPx > wc.width) { state.waveScroll = state.timeStep - visibleSteps; } state.waveScroll = Math.max(0, state.waveScroll);