From cce038932ba75e1e92961994ced5d7d6ccaae230 Mon Sep 17 00:00:00 2001 From: = <=> Date: Sun, 26 Jul 2026 11:53:37 +0300 Subject: [PATCH] perf: draw vu meter and timeline ruler on canvases --- app.js | 144 ++++++++++++++++++++++++++++++++++++++---------- ruler-worker.js | 101 +++++++++++++++++++++++++++++++++ style.css | 15 +---- 3 files changed, 219 insertions(+), 41 deletions(-) create mode 100644 ruler-worker.js diff --git a/app.js b/app.js index 1afaac7..12be581 100644 --- a/app.js +++ b/app.js @@ -1387,11 +1387,14 @@ function playRange() { function playLimited() { return state.workAreaPlay && !state.exporting && hasWorkArea(); } -/* Stop time while Limit is on. Playhead past OUT = manual override → full timeline. */ -function playStopAt() { - if (!playLimited()) return Math.max(projDur(), 0); +/* Stop time while Limit is on. Playhead past OUT = manual override → full timeline. + `dur`, if given, is a precomputed projDur() (callers already looping every + clip once per frame can reuse it instead of triggering a second full scan). */ +function playStopAt(dur) { + const d = Math.max(dur ?? projDur(), 0); + if (!playLimited()) return d; const { end } = playRange(); - if (state.time > end + 1e-4) return Math.max(projDur(), 0); + if (state.time > end + 1e-4) return d; return end; } function gotoHome() { @@ -1603,13 +1606,46 @@ function drawClipWave(cv, c, trackH) { } } -/* ── Ruler ── */ +/* ── Ruler ── + Pure vector 2D drawing with no