fix: lol web APIs exist

This commit is contained in:
Tanner Reits
2024-10-15 16:33:40 -04:00
parent 7b67c26ba0
commit e26c8ff8ad

View File

@ -497,22 +497,10 @@ export class Segment implements ComponentInterface {
}; };
indicator.querySelector('div')!.style.backgroundColor = interpolateColor(); indicator.querySelector('div')!.style.backgroundColor = interpolateColor();
// Scroll the segment container if the indicator is out of view // Scroll the segment container so the indicator is always in view
const indicatorRect = indicator.getBoundingClientRect(); indicator.scrollIntoView({
const indicatorX = indicatorRect.x; behavior: 'instant',
if (scrollDistance < 0 && indicatorX < 0) { });
this.el.scrollBy({
top: 0,
left: indicatorX,
behavior: 'instant',
});
} else if (scrollDistance > 0 && indicatorX + currentButtonWidth > this.el.offsetWidth) {
this.el.scrollBy({
top: 0,
left: indicatorX + indicatorRect.width - this.el.offsetWidth,
behavior: 'instant',
});
}
} }
} }
} }