fix: TempoTrackLane reads scrollLeft from DOM instead of React prop

This commit is contained in:
2026-07-25 09:30:42 +07:00
parent 6aed5e2ec8
commit e5a563d343
2 changed files with 15 additions and 4 deletions
+6 -1
View File
@@ -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);