ng-virtual-list 14.12.1 → 14.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.
@@ -3942,7 +3942,7 @@ Animator._nextId = 0;
3942
3942
  const SCROLL_VIEW_INVERSION = new InjectionToken('ScrollViewInversion');
3943
3943
  const SCROLL_VIEW_OVERSCROLL_ENABLED = new InjectionToken('ScrollViewOverscrollEnabled');
3944
3944
  const SCROLL_VIEW_NORMALIZE_VALUE_FROM_ZERO = new InjectionToken('ScrollViewNormalizeValueFromZero');
3945
- 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, INTERSECTION_DISTANCE = 1;
3945
+ 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;
3946
3946
  const MAX_ITERATIONS_FOR_AVERAGE_CALCULATIONS = 5, INSTANT_VELOCITY_SCALE = 1000;
3947
3947
  const SCROLL_EVENT$1 = new Event(SCROLLER_SCROLL);
3948
3948
 
@@ -4847,8 +4847,8 @@ class NgScrollView extends BaseScrollView {
4847
4847
  continue;
4848
4848
  }
4849
4849
  if (v00) {
4850
- 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) : 0.1;
4851
- aSum = (aSum * mass) + a0;
4850
+ 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;
4851
+ aSum = Math.abs((aSum * mass)) + Math.abs(a0);
4852
4852
  prevV0 = v01;
4853
4853
  }
4854
4854
  prevV0 = v01;
@@ -4869,7 +4869,7 @@ class NgScrollView extends BaseScrollView {
4869
4869
  }
4870
4870
  moveWithAcceleration(isVertical, position, v0, v, a0, timestamp) {
4871
4871
  if (a0 !== 0 && timestamp < MAX_VELOCITY_TIMESTAMP) {
4872
- 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) / 1000) / mass, distance = Math.abs(s) < maxDist ? s : maxDistance, positionWithVelocity = position + (this._inversion ? -1 : 1) * distance, vmax = Math.max(Math.abs(v0), Math.abs(v)), ad = Math.abs(vmax !== 0 ? Math.sqrt(vmax) : 0) * 10 / mass, aDuration = ad < maxDuration ? ad : maxDuration, startPosition = isVertical ? this.y : this.x;
4872
+ 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;
4873
4873
  this.animate(startPosition, Math.round(positionWithVelocity), aDuration, easeOutQuad, true);
4874
4874
  }
4875
4875
  else {
@@ -5449,13 +5449,13 @@ class NgScrollBarComponent extends NgScrollView {
5449
5449
  })).subscribe();
5450
5450
  }
5451
5451
  createDragEvent(userAction) {
5452
- const isVertical = this._$isVertical.getValue(), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, scrollContent = this.scrollContent?.nativeElement, scrollViewport = this.scrollViewport?.nativeElement;
5452
+ const isVertical = this._$isVertical.getValue(), 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;
5453
5453
  if (!!scrollViewport && !!scrollContent) {
5454
- const contentSize = isVertical ? scrollContent.offsetHeight : scrollContent.offsetWidth, viewportSize = isVertical ? scrollViewport.offsetHeight : scrollViewport.offsetWidth;
5454
+ 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);
5455
5455
  const event = {
5456
- position: scrollSize !== 0 ? ((isVertical ? this._y : this._x) / scrollSize) : 0,
5457
- min: scrollSize !== 0 ? (this.startOffset / scrollSize) : 0,
5458
- max: scrollSize !== 0 ? ((viewportSize - this.endOffset - contentSize) / scrollSize) : 0,
5456
+ position: pos / maxSize,
5457
+ min: scrollSize !== 0 ? (startOffset / scrollSize) : 0,
5458
+ max: scrollSize !== 0 ? ((viewportSize - endOffset - contentSize) / scrollSize) : 0,
5459
5459
  animation: !this._isMoving,
5460
5460
  userAction,
5461
5461
  };