mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
fix(animation): account for negative values on menu gesture (#19196)
This commit is contained in:
@ -415,6 +415,14 @@ export class Menu implements ComponentInterface, MenuI {
|
|||||||
// Account for rounding errors in JS
|
// Account for rounding errors in JS
|
||||||
let newStepValue = (shouldComplete) ? 0.001 : -0.001;
|
let newStepValue = (shouldComplete) ? 0.001 : -0.001;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: stepValue can sometimes return a negative
|
||||||
|
* value, but you can't have a negative time value
|
||||||
|
* for the cubic bezier curve (at least with web animations)
|
||||||
|
* Not sure if the negative step value is an error or not
|
||||||
|
*/
|
||||||
|
const adjustedStepValue = (stepValue <= 0) ? 0.01 : stepValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Animation will be reversed here, so need to
|
* Animation will be reversed here, so need to
|
||||||
* reverse the easing curve as well
|
* reverse the easing curve as well
|
||||||
@ -423,7 +431,7 @@ export class Menu implements ComponentInterface, MenuI {
|
|||||||
* to the new easing curve, as `stepValue` is going to be given
|
* to the new easing curve, as `stepValue` is going to be given
|
||||||
* in terms of a linear curve.
|
* in terms of a linear curve.
|
||||||
*/
|
*/
|
||||||
newStepValue += getTimeGivenProgression(new Point(0, 0), new Point(0.4, 0), new Point(0.6, 1), new Point(1, 1), stepValue);
|
newStepValue += getTimeGivenProgression(new Point(0, 0), new Point(0.4, 0), new Point(0.6, 1), new Point(1, 1), adjustedStepValue);
|
||||||
|
|
||||||
this.animation
|
this.animation
|
||||||
.easing('cubic-bezier(0.4, 0.0, 0.6, 1)')
|
.easing('cubic-bezier(0.4, 0.0, 0.6, 1)')
|
||||||
|
Reference in New Issue
Block a user