ng-virtual-list 20.12.3 → 20.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/fesm2022/ng-virtual-list.mjs +12 -10
- package/fesm2022/ng-virtual-list.mjs.map +1 -1
- package/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -4057,8 +4057,9 @@ class Animator {
|
|
|
4057
4057
|
_diff = 0;
|
|
4058
4058
|
_startValue = 0;
|
|
4059
4059
|
_endValue = 0;
|
|
4060
|
-
|
|
4061
|
-
|
|
4060
|
+
_prevPos = 0;
|
|
4061
|
+
updateTo(end) {
|
|
4062
|
+
this._endValue = end;
|
|
4062
4063
|
this._diff = this._endValue - this._startValue;
|
|
4063
4064
|
return this.hasAnimation();
|
|
4064
4065
|
}
|
|
@@ -4070,7 +4071,8 @@ class Animator {
|
|
|
4070
4071
|
this._startValue = startValue;
|
|
4071
4072
|
this._endValue = endValue;
|
|
4072
4073
|
const startTime = performance.now();
|
|
4073
|
-
let isCanceled = false,
|
|
4074
|
+
let isCanceled = false, startPosDelta = 0, delta = 0, prevTime = startTime, isFinished = false;
|
|
4075
|
+
this._prevPos = startValue;
|
|
4074
4076
|
this._diff = this._endValue - this._startValue;
|
|
4075
4077
|
const step = (currentTime) => {
|
|
4076
4078
|
if (id !== this._currentId) {
|
|
@@ -4081,22 +4083,22 @@ class Animator {
|
|
|
4081
4083
|
}
|
|
4082
4084
|
const cPos = getPropValue?.() || 0;
|
|
4083
4085
|
let startDelta = 0;
|
|
4084
|
-
if (cPos !==
|
|
4085
|
-
startDelta = cPos -
|
|
4086
|
+
if (cPos !== this._prevPos) {
|
|
4087
|
+
startDelta = cPos - this._prevPos;
|
|
4086
4088
|
startPosDelta += startDelta;
|
|
4087
4089
|
}
|
|
4088
|
-
const elapsed = currentTime - startTime, progress = this._startValue ===
|
|
4090
|
+
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();
|
|
4089
4091
|
isFinished = progress === 1;
|
|
4090
|
-
delta = currentValue - startDelta -
|
|
4092
|
+
delta = currentValue - startDelta - this._prevPos;
|
|
4091
4093
|
const frameTimestamp = t - prevTime, actualFrameTimestamp = frameTimestamp < ANIMATOR_MIN_TIMESTAMP ? ANIMATOR_MIN_TIMESTAMP : frameTimestamp;
|
|
4092
4094
|
prevTime = t;
|
|
4093
|
-
|
|
4095
|
+
this._prevPos = currentValue;
|
|
4094
4096
|
if (onUpdate !== undefined) {
|
|
4095
4097
|
const data = {
|
|
4096
4098
|
id,
|
|
4097
4099
|
delta,
|
|
4098
4100
|
elapsed,
|
|
4099
|
-
value:
|
|
4101
|
+
value: currentValue,
|
|
4100
4102
|
timestamp: actualFrameTimestamp,
|
|
4101
4103
|
};
|
|
4102
4104
|
onUpdate(data);
|
|
@@ -4108,7 +4110,7 @@ class Animator {
|
|
|
4108
4110
|
id,
|
|
4109
4111
|
delta,
|
|
4110
4112
|
elapsed,
|
|
4111
|
-
value:
|
|
4113
|
+
value: currentValue,
|
|
4112
4114
|
timestamp: actualFrameTimestamp,
|
|
4113
4115
|
};
|
|
4114
4116
|
onComplete(data);
|