fix: revert TempoTrackLane PADDING_LEFT to 2s, remove DOM scrollLeft hack
This commit is contained in:
@@ -1206,13 +1206,7 @@ const TempoTrackLane = ({
|
||||
if (!canvas) return;
|
||||
const ctx = canvas.getContext('2d');
|
||||
const dpr = window.devicePixelRatio || 1;
|
||||
let el = canvas.parentElement;
|
||||
while (el) {
|
||||
const ox = getComputedStyle(el).overflowX;
|
||||
if (ox === 'auto' || ox === 'scroll') break;
|
||||
el = el.parentElement;
|
||||
}
|
||||
const scrollLeftVal = el ? el.scrollLeft : (scrollLeft || 0);
|
||||
const scrollLeftVal = scrollLeft || 0;
|
||||
const height = canvas.parentElement ? canvas.parentElement.clientHeight : 40;
|
||||
canvas.width = Math.min(Math.round(drawWidth * dpr), 32768);
|
||||
canvas.height = Math.min(Math.round(height * dpr), 32768);
|
||||
@@ -1224,7 +1218,7 @@ const TempoTrackLane = ({
|
||||
ctx.fillRect(0, 0, drawWidth, height);
|
||||
const beatDuration = 60 / bpm;
|
||||
const barDuration = beatDuration * 4;
|
||||
const PADDING_LEFT = beatDuration; // 1-beat margin on left
|
||||
const PADDING_LEFT = 2; // seconds of empty space on left edge
|
||||
const tStart = scrollLeftVal / zoom - PADDING_LEFT;
|
||||
const tEnd = (scrollLeftVal + drawWidth) / zoom;
|
||||
const firstBeat = Math.floor(tStart / beatDuration) * beatDuration;
|
||||
|
||||
Reference in New Issue
Block a user