fix: tempo lane DOM scrollLeft traversal finds overflow-x:auto parent
This commit is contained in:
@@ -1207,11 +1207,12 @@ const TempoTrackLane = ({
|
||||
const ctx = canvas.getContext('2d');
|
||||
const dpr = window.devicePixelRatio || 1;
|
||||
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;
|
||||
while (el) {
|
||||
const ox = getComputedStyle(el).overflowX;
|
||||
if (ox === 'auto' || ox === 'scroll') break;
|
||||
el = el.parentElement;
|
||||
}
|
||||
const scrollLeftVal = el && el.scrollWidth > el.clientWidth ? el.scrollLeft : (scrollLeft || 0);
|
||||
const scrollLeftVal = el ? 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