mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 02:31:34 +08:00
fix: lol web APIs exist
This commit is contained in:
@ -497,22 +497,10 @@ export class Segment implements ComponentInterface {
|
||||
};
|
||||
indicator.querySelector('div')!.style.backgroundColor = interpolateColor();
|
||||
|
||||
// Scroll the segment container if the indicator is out of view
|
||||
const indicatorRect = indicator.getBoundingClientRect();
|
||||
const indicatorX = indicatorRect.x;
|
||||
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',
|
||||
});
|
||||
}
|
||||
// Scroll the segment container so the indicator is always in view
|
||||
indicator.scrollIntoView({
|
||||
behavior: 'instant',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user