Fix waveform auto-scroll: always follow regardless of zoom level
Remove conditional that could skip scroll update when zooming. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -132,11 +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: always follow the latest data
|
// Auto-scroll: always follow the latest data, keep cursor at right edge
|
||||||
if (totalPx > wc.width) {
|
state.waveScroll = Math.max(0, state.timeStep - visibleSteps);
|
||||||
state.waveScroll = state.timeStep - visibleSteps;
|
|
||||||
}
|
|
||||||
state.waveScroll = Math.max(0, state.waveScroll);
|
|
||||||
|
|
||||||
// Helper: convert simulation step to pixel X
|
// Helper: convert simulation step to pixel X
|
||||||
const tToX = (t) => (t - state.waveScroll) * pxPerStep;
|
const tToX = (t) => (t - state.waveScroll) * pxPerStep;
|
||||||
|
|||||||
Reference in New Issue
Block a user