summaryrefslogtreecommitdiff
path: root/tools/timeline_editor/timeline-playback.js
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-15 15:00:57 +0100
committerskal <pascal.massimino@gmail.com>2026-02-15 15:00:57 +0100
commitf23bd208b38ccfdc814daa99818a7e119f5ee313 (patch)
tree3580311b5f4376604f3dde81e3632940e262ab19 /tools/timeline_editor/timeline-playback.js
parent2031e24c976d1a11eb48badb97e824b1db07741a (diff)
refactor(timeline-editor): centralize BPM calculations
Replace repeated 60.0/bpm calculations with precomputed secondsPerBeat and beatsPerSecond properties. Add computeBPMValues helper and updateBPM function for consistency. Also prevent wheel events on time markers. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/timeline_editor/timeline-playback.js')
-rw-r--r--tools/timeline_editor/timeline-playback.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/timeline_editor/timeline-playback.js b/tools/timeline_editor/timeline-playback.js
index bfeb75a..17223ac 100644
--- a/tools/timeline_editor/timeline-playback.js
+++ b/tools/timeline_editor/timeline-playback.js
@@ -117,7 +117,7 @@ export class PlaybackController {
}
}
if (this.state.audioDuration > 0) {
- maxTime = Math.max(maxTime, this.state.audioDuration * this.state.bpm / 60.0);
+ maxTime = Math.max(maxTime, this.state.audioDuration * this.state.beatsPerSecond);
}
const w = maxTime * this.state.pixelsPerSecond;
@@ -313,10 +313,10 @@ export class PlaybackController {
// Helpers
beatsToTime(beats) {
- return beats * 60.0 / this.state.bpm;
+ return beats * this.state.secondsPerBeat;
}
timeToBeats(seconds) {
- return seconds * this.state.bpm / 60.0;
+ return seconds * this.state.beatsPerSecond;
}
}