fix: remove alert(), fix waveform zoom, add waveform scroll (wheel + ctrl+wheel)

This commit is contained in:
Jose Luis Montañes
2026-03-19 22:08:26 +01:00
parent d5de328898
commit 7c58174f5f
3 changed files with 22 additions and 5 deletions

View File

@@ -121,11 +121,14 @@ export function drawWaveforms() {
return;
}
// Auto-scroll to show latest
// Auto-scroll to show latest (only if we're already near the end)
const maxVisible = Math.floor(wc.width / state.waveZoom);
if (state.timeStep > maxVisible) {
const isNearEnd = state.waveScroll >= state.timeStep - maxVisible - 2;
if (state.timeStep > maxVisible && isNearEnd) {
state.waveScroll = state.timeStep - maxVisible;
}
// Clamp scroll to valid range
state.waveScroll = Math.max(0, Math.min(state.timeStep - 1, state.waveScroll));
// Draw time grid
wctx.strokeStyle = '#151520';