mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix segment right scroll
This commit is contained in:
@@ -459,7 +459,8 @@ export class Segment implements ComponentInterface {
|
||||
}
|
||||
|
||||
// Scroll the segment container if the indicator is out of view
|
||||
const indicatorX = indicator.getBoundingClientRect().x;
|
||||
const indicatorRect = indicator.getBoundingClientRect();
|
||||
const indicatorX = indicatorRect.x;
|
||||
if (scrollDistance < 0 && indicatorX < 0) {
|
||||
this.el.scrollBy({
|
||||
top: 0,
|
||||
@@ -469,7 +470,7 @@ export class Segment implements ComponentInterface {
|
||||
} else if (scrollDistance > 0 && indicatorX + currentButtonWidth > this.el.offsetWidth) {
|
||||
this.el.scrollBy({
|
||||
top: 0,
|
||||
left: indicatorX + currentButtonWidth - this.el.offsetWidth,
|
||||
left: indicatorX + indicatorRect.width - this.el.offsetWidth,
|
||||
behavior: 'instant',
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user