ng-virtual-list 21.12.1 → 21.12.2
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.
|
@@ -4038,7 +4038,7 @@ class Animator {
|
|
|
4038
4038
|
const SCROLL_VIEW_INVERSION = new InjectionToken('ScrollViewInversion');
|
|
4039
4039
|
const SCROLL_VIEW_OVERSCROLL_ENABLED = new InjectionToken('ScrollViewOverscrollEnabled');
|
|
4040
4040
|
const SCROLL_VIEW_NORMALIZE_VALUE_FROM_ZERO = new InjectionToken('ScrollViewNormalizeValueFromZero');
|
|
4041
|
-
const TOP$1 = 'top', LEFT$1 = 'left', INSTANT$1 = 'instant', AUTO = 'auto', SMOOTH = 'smooth', DURATION = 2000, FRICTION_FORCE = .035, MAX_DURATION = 4000, ANIMATION_DURATION = 50, MASS = .005, MAX_DIST = 12500, MAX_VELOCITY_TIMESTAMP = 100, SPEED_SCALE = 15, OVERSCROLL_START_ITERATION = 2
|
|
4041
|
+
const TOP$1 = 'top', LEFT$1 = 'left', INSTANT$1 = 'instant', AUTO = 'auto', SMOOTH = 'smooth', DURATION = 2000, FRICTION_FORCE = .035, MAX_DURATION = 4000, ANIMATION_DURATION = 50, MASS = .005, ACCELERATION_SCALE = 40, MAX_DIST = 12500, MAX_VELOCITY_TIMESTAMP = 100, SPEED_SCALE = 15, OVERSCROLL_START_ITERATION = 2;
|
|
4042
4042
|
const MAX_ITERATIONS_FOR_AVERAGE_CALCULATIONS = 5, INSTANT_VELOCITY_SCALE = 1000;
|
|
4043
4043
|
const SCROLL_EVENT$1 = new Event(SCROLLER_SCROLL);
|
|
4044
4044
|
|
|
@@ -4795,8 +4795,8 @@ class NgScrollView extends BaseScrollView {
|
|
|
4795
4795
|
continue;
|
|
4796
4796
|
}
|
|
4797
4797
|
if (v00) {
|
|
4798
|
-
const a0 = timestamp < MAX_VELOCITY_TIMESTAMP ? (v00[1] !== 0 ? (lastVSign * Math.abs(Math.abs(v01[0]) - Math.abs(v00[0]))) / Math.abs(v00[1]) : 0) :
|
|
4799
|
-
aSum = (aSum * mass) + a0;
|
|
4798
|
+
const a0 = timestamp < MAX_VELOCITY_TIMESTAMP ? (v00[1] !== 0 ? (lastVSign * Math.abs(Math.abs(v01[0]) - Math.abs(v00[0]))) / Math.abs(v00[1]) : 0) : .1;
|
|
4799
|
+
aSum = Math.abs((aSum * mass)) + Math.abs(a0);
|
|
4800
4800
|
prevV0 = v01;
|
|
4801
4801
|
}
|
|
4802
4802
|
prevV0 = v01;
|
|
@@ -4817,7 +4817,7 @@ class NgScrollView extends BaseScrollView {
|
|
|
4817
4817
|
}
|
|
4818
4818
|
moveWithAcceleration(isVertical, position, v0, v, a0, timestamp) {
|
|
4819
4819
|
if (a0 !== 0 && timestamp < MAX_VELOCITY_TIMESTAMP) {
|
|
4820
|
-
const dvSign = Math.sign(v), mass = this.scrollingSettings()?.mass ?? MASS, duration = DURATION, maxDuration = this.scrollingSettings()?.maxDuration ?? MAX_DURATION, maxDist = this.scrollingSettings()?.maxDistance ?? MAX_DIST, maxDistance = dvSign * maxDist, s = (dvSign * Math.abs((a0 * Math.pow(duration, 2)) * .5) /
|
|
4820
|
+
const dvSign = Math.sign(v), mass = this.scrollingSettings()?.mass ?? MASS, duration = DURATION, maxDuration = this.scrollingSettings()?.maxDuration ?? MAX_DURATION, maxDist = this.scrollingSettings()?.maxDistance ?? MAX_DIST, maxDistance = dvSign * maxDist, s = (dvSign * Math.abs((a0 * Math.pow(duration, 2)) * .5) / 10000) / mass, distance = Math.abs(s) < maxDist ? s : maxDistance, positionWithVelocity = position + (this._inversion ? -1 : 1) * distance, ad = Math.abs(a0 !== 0 ? Math.sqrt(a0) : 0) * ACCELERATION_SCALE / mass, aDuration = ad < maxDuration ? ad : maxDuration, startPosition = isVertical ? this.y : this.x;
|
|
4821
4821
|
this.animate(startPosition, Math.round(positionWithVelocity), aDuration, easeOutQuad, true);
|
|
4822
4822
|
}
|
|
4823
4823
|
else {
|
|
@@ -5276,13 +5276,13 @@ class NgScrollBarComponent extends NgScrollView {
|
|
|
5276
5276
|
})).subscribe();
|
|
5277
5277
|
}
|
|
5278
5278
|
createDragEvent(userAction) {
|
|
5279
|
-
const isVertical = this.isVertical(), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, scrollContent = this.scrollContent()?.nativeElement, scrollViewport = this.scrollViewport()?.nativeElement;
|
|
5279
|
+
const isVertical = this.isVertical(), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, scrollPosition = isVertical ? this.scrollTop : this.scrollLeft, startOffset = this.startOffset(), endOffset = this.endOffset(), scrollContent = this.scrollContent()?.nativeElement, scrollViewport = this.scrollViewport()?.nativeElement;
|
|
5280
5280
|
if (!!scrollViewport && !!scrollContent) {
|
|
5281
|
-
const contentSize = isVertical ? scrollContent.offsetHeight : scrollContent.offsetWidth, viewportSize = isVertical ? scrollViewport.offsetHeight : scrollViewport.offsetWidth;
|
|
5281
|
+
const contentSize = isVertical ? scrollContent.offsetHeight : scrollContent.offsetWidth, viewportSize = isVertical ? scrollViewport.offsetHeight : scrollViewport.offsetWidth, offsetSize = (scrollSize !== 0 ? (startOffset / scrollSize) : 0), positionSize = (scrollSize !== 0 ? (scrollPosition / scrollSize) : 0), maxSize = 1 - offsetSize, pos = (positionSize - offsetSize);
|
|
5282
5282
|
const event = {
|
|
5283
|
-
position:
|
|
5284
|
-
min: scrollSize !== 0 ? (
|
|
5285
|
-
max: scrollSize !== 0 ? ((viewportSize -
|
|
5283
|
+
position: pos / maxSize,
|
|
5284
|
+
min: scrollSize !== 0 ? (startOffset / scrollSize) : 0,
|
|
5285
|
+
max: scrollSize !== 0 ? ((viewportSize - endOffset - contentSize) / scrollSize) : 0,
|
|
5286
5286
|
animation: !this._isMoving,
|
|
5287
5287
|
userAction,
|
|
5288
5288
|
};
|