ng-virtual-list 14.12.3 → 14.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/utils/animator/animator.mjs +13 -11
- package/fesm2015/ng-virtual-list.mjs +12 -10
- package/fesm2015/ng-virtual-list.mjs.map +1 -1
- package/fesm2020/ng-virtual-list.mjs +12 -10
- package/fesm2020/ng-virtual-list.mjs.map +1 -1
- package/lib/utils/animator/animator.d.ts +2 -1
- package/package.json +1 -1
|
@@ -3957,6 +3957,7 @@ class Animator {
|
|
|
3957
3957
|
this._diff = 0;
|
|
3958
3958
|
this._startValue = 0;
|
|
3959
3959
|
this._endValue = 0;
|
|
3960
|
+
this._prevPos = 0;
|
|
3960
3961
|
}
|
|
3961
3962
|
get animated() { return this._animationId > -1; }
|
|
3962
3963
|
get isAnimated() { return this.hasAnimation(this._currentId); }
|
|
@@ -3965,8 +3966,8 @@ class Animator {
|
|
|
3965
3966
|
return Animator._nextId = Animator._nextId === Number.MAX_SAFE_INTEGER
|
|
3966
3967
|
? 0 : Animator._nextId + 1;
|
|
3967
3968
|
}
|
|
3968
|
-
updateTo(
|
|
3969
|
-
this._endValue =
|
|
3969
|
+
updateTo(end) {
|
|
3970
|
+
this._endValue = end;
|
|
3970
3971
|
this._diff = this._endValue - this._startValue;
|
|
3971
3972
|
return this.hasAnimation();
|
|
3972
3973
|
}
|
|
@@ -3978,7 +3979,8 @@ class Animator {
|
|
|
3978
3979
|
this._startValue = startValue;
|
|
3979
3980
|
this._endValue = endValue;
|
|
3980
3981
|
const startTime = performance.now();
|
|
3981
|
-
let isCanceled = false,
|
|
3982
|
+
let isCanceled = false, startPosDelta = 0, delta = 0, prevTime = startTime, isFinished = false;
|
|
3983
|
+
this._prevPos = startValue;
|
|
3982
3984
|
this._diff = this._endValue - this._startValue;
|
|
3983
3985
|
const step = (currentTime) => {
|
|
3984
3986
|
if (id !== this._currentId) {
|
|
@@ -3989,22 +3991,22 @@ class Animator {
|
|
|
3989
3991
|
}
|
|
3990
3992
|
const cPos = getPropValue?.() || 0;
|
|
3991
3993
|
let startDelta = 0;
|
|
3992
|
-
if (cPos !==
|
|
3993
|
-
startDelta = cPos -
|
|
3994
|
+
if (cPos !== this._prevPos) {
|
|
3995
|
+
startDelta = cPos - this._prevPos;
|
|
3994
3996
|
startPosDelta += startDelta;
|
|
3995
3997
|
}
|
|
3996
|
-
const elapsed = currentTime - startTime, progress = this._startValue ===
|
|
3998
|
+
const elapsed = currentTime - startTime, progress = this._startValue === this._endValue ? 1 : Math.min(duration > 0 ? elapsed / duration : 0, 1), easedProgress = easingFunction(progress), val = (withDelta ? startPosDelta : 0) + this._startValue + this._diff * easedProgress, currentValue = val, t = performance.now();
|
|
3997
3999
|
isFinished = progress === 1;
|
|
3998
|
-
delta = currentValue - startDelta -
|
|
4000
|
+
delta = currentValue - startDelta - this._prevPos;
|
|
3999
4001
|
const frameTimestamp = t - prevTime, actualFrameTimestamp = frameTimestamp < ANIMATOR_MIN_TIMESTAMP ? ANIMATOR_MIN_TIMESTAMP : frameTimestamp;
|
|
4000
4002
|
prevTime = t;
|
|
4001
|
-
|
|
4003
|
+
this._prevPos = currentValue;
|
|
4002
4004
|
if (onUpdate !== undefined) {
|
|
4003
4005
|
const data = {
|
|
4004
4006
|
id,
|
|
4005
4007
|
delta,
|
|
4006
4008
|
elapsed,
|
|
4007
|
-
value:
|
|
4009
|
+
value: currentValue,
|
|
4008
4010
|
timestamp: actualFrameTimestamp,
|
|
4009
4011
|
};
|
|
4010
4012
|
onUpdate(data);
|
|
@@ -4016,7 +4018,7 @@ class Animator {
|
|
|
4016
4018
|
id,
|
|
4017
4019
|
delta,
|
|
4018
4020
|
elapsed,
|
|
4019
|
-
value:
|
|
4021
|
+
value: currentValue,
|
|
4020
4022
|
timestamp: actualFrameTimestamp,
|
|
4021
4023
|
};
|
|
4022
4024
|
onComplete(data);
|