fix: TempoTrackLane bar spacing by removing broken DOM scrollLeft lookup
- DOM traversal for scrollLeft stops at sticky wrapper (scrollLeft=0) - Use scrollLeft prop directly instead of traversing parent DOM - Affects both TimelineRuler and TempoTrackLane canvas effects - Bars now correctly space when BPM changes
This commit is contained in:
+1
-17
@@ -1222,14 +1222,6 @@ const TimelineRuler = ({
|
||||
const ctx = canvas.getContext('2d');
|
||||
const dpr = window.devicePixelRatio || 1;
|
||||
let scrollLeftVal = scrollLeft || 0;
|
||||
let el = canvas.parentElement;
|
||||
while (el) {
|
||||
if (el.scrollLeft !== undefined && (el.scrollWidth > el.clientWidth || el.scrollLeft > 0)) {
|
||||
scrollLeftVal = el.scrollLeft;
|
||||
break;
|
||||
}
|
||||
el = el.parentElement;
|
||||
}
|
||||
const height = RULER_HEIGHT;
|
||||
canvas.width = Math.min(Math.round(drawWidth * dpr), 32768);
|
||||
canvas.height = Math.min(Math.round(height * dpr), 32768);
|
||||
@@ -1315,16 +1307,8 @@ const TempoTrackLane = ({
|
||||
if (!canvas) return;
|
||||
const ctx = canvas.getContext('2d');
|
||||
const dpr = window.devicePixelRatio || 1;
|
||||
// Read scrollLeft from the DOM wrapper directly to stay in sync with tracks
|
||||
// Use scrollLeft prop directly (DOM traversal broken by sticky wrapper)
|
||||
let scrollLeftVal = scrollLeft || 0;
|
||||
let el = canvas.parentElement;
|
||||
while (el) {
|
||||
if (el.scrollLeft !== undefined && (el.scrollWidth > el.clientWidth || el.scrollLeft > 0)) {
|
||||
scrollLeftVal = el.scrollLeft;
|
||||
break;
|
||||
}
|
||||
el = el.parentElement;
|
||||
}
|
||||
const height = 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