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:
@@ -132,9 +132,8 @@ export function drawWaveforms() {
|
|||||||
// Visible width in steps
|
// Visible width in steps
|
||||||
const visibleSteps = wc.width / pxPerStep;
|
const visibleSteps = wc.width / pxPerStep;
|
||||||
|
|
||||||
// Auto-scroll to show latest (only if near the end)
|
// Auto-scroll: always follow the latest data
|
||||||
const isNearEnd = state.waveScroll >= state.timeStep - visibleSteps - 2;
|
if (totalPx > wc.width) {
|
||||||
if (totalPx > wc.width && isNearEnd) {
|
|
||||||
state.waveScroll = state.timeStep - visibleSteps;
|
state.waveScroll = state.timeStep - visibleSteps;
|
||||||
}
|
}
|
||||||
state.waveScroll = Math.max(0, state.waveScroll);
|
state.waveScroll = Math.max(0, state.waveScroll);
|
||||||
|
|||||||
Reference in New Issue
Block a user