mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 18:54:11 +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();
|
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',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user