mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
fix(picker): pick correct option at low velocities (#19660)
fixes #19659
This commit is contained in:

committed by
Liam DeBeasi

parent
cf287fda7f
commit
39d12629db
@ -313,6 +313,18 @@ export class PickerColumnCmp implements ComponentInterface {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.y += detail.deltaY;
|
this.y += detail.deltaY;
|
||||||
|
|
||||||
|
if (Math.abs(detail.velocityY) < 0.05) {
|
||||||
|
const isScrollingUp = detail.deltaY > 0;
|
||||||
|
const optHeightFraction = (Math.abs(this.y) % this.optHeight) / this.optHeight;
|
||||||
|
|
||||||
|
if (isScrollingUp && optHeightFraction > 0.5) {
|
||||||
|
this.velocity = Math.abs(this.velocity) * -1;
|
||||||
|
} else if (!isScrollingUp && optHeightFraction <= 0.5) {
|
||||||
|
this.velocity = Math.abs(this.velocity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.decelerate();
|
this.decelerate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user