fix: TempoTrackLane reads scrollLeft from DOM instead of React prop
This commit is contained in:
@@ -1206,7 +1206,12 @@ const TempoTrackLane = ({
|
||||
if (!canvas) return;
|
||||
const ctx = canvas.getContext('2d');
|
||||
const dpr = window.devicePixelRatio || 1;
|
||||
const scrollLeftVal = scrollLeft || 0;
|
||||
let el = canvas.parentElement;
|
||||
for (let i = 0; i < 4 && el; i++) {
|
||||
if (el.scrollWidth > el.clientWidth || getComputedStyle(el).overflowX === 'auto' || getComputedStyle(el).overflowX === 'scroll') break;
|
||||
el = el.parentElement;
|
||||
}
|
||||
const scrollLeftVal = el && el.scrollWidth > el.clientWidth ? el.scrollLeft : (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);
|
||||
|
||||
Reference in New Issue
Block a user