diff options
| -rw-r--r-- | tools/timeline_editor/timeline-playback.js | 14 | ||||
| -rw-r--r-- | tools/timeline_editor/timeline-viewport.js | 8 |
2 files changed, 11 insertions, 11 deletions
diff --git a/tools/timeline_editor/timeline-playback.js b/tools/timeline_editor/timeline-playback.js index 5427499..8c84877 100644 --- a/tools/timeline_editor/timeline-playback.js +++ b/tools/timeline_editor/timeline-playback.js @@ -108,19 +108,19 @@ export class PlaybackController { const canvas = this.dom.waveformCanvas; const ctx = canvas.getContext('2d'); - // Calculate maxTime same as timeline - let maxTime = 60; + // Calculate maxTimeBeats same as timeline + let maxTimeBeats = 60; for (const seq of this.state.sequences) { - maxTime = Math.max(maxTime, seq.startTime + this.SEQUENCE_DEFAULT_DURATION); + maxTimeBeats = Math.max(maxTimeBeats, seq.startTime + this.SEQUENCE_DEFAULT_DURATION); for (const effect of seq.effects) { - maxTime = Math.max(maxTime, seq.startTime + effect.endTime); + maxTimeBeats = Math.max(maxTimeBeats, seq.startTime + effect.endTime); } } if (this.state.audioDurationSeconds > 0) { - maxTime = Math.max(maxTime, this.state.audioDurationSeconds * this.state.beatsPerSecond); + maxTimeBeats = Math.max(maxTimeBeats, this.state.audioDurationSeconds * this.state.beatsPerSecond); } - const w = maxTime * this.state.pixelsPerBeat; + const w = maxTimeBeats * this.state.pixelsPerBeat; const h = 80; canvas.width = w; canvas.height = h; @@ -170,7 +170,7 @@ export class PlaybackController { // Beat markers ctx.strokeStyle = 'rgba(255, 255, 255, 0.15)'; ctx.lineWidth = 1; - for (let beat = 0; beat <= maxTime; beat++) { + for (let beat = 0; beat <= maxTimeBeats; beat++) { const x = beat * this.state.pixelsPerBeat; ctx.beginPath(); ctx.moveTo(x, 0); diff --git a/tools/timeline_editor/timeline-viewport.js b/tools/timeline_editor/timeline-viewport.js index 30f2403..196368e 100644 --- a/tools/timeline_editor/timeline-viewport.js +++ b/tools/timeline_editor/timeline-viewport.js @@ -77,14 +77,14 @@ export class ViewportController { const timeUnderCursor = (scrollLeft + mouseX) / this.state.pixelsPerBeat; const zoomDelta = e.deltaY > 0 ? -10 : 10; - const newPixelsPerSecond = Math.max(10, Math.min(500, this.state.pixelsPerBeat + zoomDelta)); + const newPixelsPerBeat = Math.max(10, Math.min(500, this.state.pixelsPerBeat + zoomDelta)); - if (newPixelsPerSecond !== this.state.pixelsPerBeat) { - this.state.pixelsPerBeat = newPixelsPerSecond; + if (newPixelsPerBeat !== this.state.pixelsPerBeat) { + this.state.pixelsPerBeat = newPixelsPerBeat; this.dom.zoomSlider.value = this.state.pixelsPerBeat; this.dom.zoomLevel.textContent = `${this.state.pixelsPerBeat}%`; this.renderCallback('zoomWheel'); - this.dom.timelineContent.scrollLeft = timeUnderCursor * newPixelsPerSecond - mouseX; + this.dom.timelineContent.scrollLeft = timeUnderCursor * newPixelsPerBeat - mouseX; this.updateIndicatorPosition(this.timeToBeats(this.state.playbackOffset), false); } } |
