mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
fix(scrollTo): change parseInt to Math.round
This commit is contained in:
@ -64,7 +64,7 @@ export class ScrollTo {
|
|||||||
if (!self._el) {
|
if (!self._el) {
|
||||||
return resolve();
|
return resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
let time = Math.min(1, ((Date.now() - start) / duration));
|
let time = Math.min(1, ((Date.now() - start) / duration));
|
||||||
|
|
||||||
// where .5 would be 50% of time on a linear scale easedT gives a
|
// where .5 would be 50% of time on a linear scale easedT gives a
|
||||||
@ -72,10 +72,10 @@ export class ScrollTo {
|
|||||||
let easedT = easeOutCubic(time);
|
let easedT = easeOutCubic(time);
|
||||||
|
|
||||||
if (fromY != y) {
|
if (fromY != y) {
|
||||||
self._el.scrollTop = parseInt((easedT * (y - fromY)) + fromY, 10);
|
self._el.scrollTop = Math.round((easedT * (y - fromY)) + fromY);
|
||||||
}
|
}
|
||||||
if (fromX != x) {
|
if (fromX != x) {
|
||||||
self._el.scrollLeft = parseInt((easedT * (x - fromX)) + fromX, 10);
|
self._el.scrollLeft = Math.round((easedT * (x - fromX)) + fromX);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time < 1 && self.isPlaying) {
|
if (time < 1 && self.isPlaying) {
|
||||||
|
Reference in New Issue
Block a user