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 <noreply@anthropic.com>
This commit is contained in:
Jose Luis Montañes
2026-03-19 22:35:16 +01:00
parent 6eb4b75446
commit 18c753cae1

View File

@@ -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);