ng-virtual-list 22.12.1 → 22.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.
package/README.md CHANGED
@@ -732,14 +732,14 @@ import { NgVirtualListModule, VirtualClickModule } from 'ng-virtual-list';
732
732
 
733
733
  | Angular version | ng-virtual-list version | git | npm |
734
734
  |--|--|--|--|
735
- | 21.x | 21.12.1 | [20.x](https://github.com/DjonnyX/ng-virtual-list/tree/21.x) | [21.12.1](https://www.npmjs.com/package/ng-virtual-list/v/21.12.1) |
736
- | 20.x | 20.12.1 | [20.x](https://github.com/DjonnyX/ng-virtual-list/tree/20.x) | [20.12.1](https://www.npmjs.com/package/ng-virtual-list/v/20.12.1) |
737
- | 19.x | 19.12.1 | [19.x](https://github.com/DjonnyX/ng-virtual-list/tree/19.x) | [19.12.1](https://www.npmjs.com/package/ng-virtual-list/v/19.12.1) |
738
- | 18.x | 18.12.1 | [18.x](https://github.com/DjonnyX/ng-virtual-list/tree/18.x) | [18.12.1](https://www.npmjs.com/package/ng-virtual-list/v/18.12.1) |
739
- | 17.x | 17.12.1 | [17.x](https://github.com/DjonnyX/ng-virtual-list/tree/17.x) | [17.12.1](https://www.npmjs.com/package/ng-virtual-list/v/17.12.1) |
740
- | 16.x | 16.12.1 | [16.x](https://github.com/DjonnyX/ng-virtual-list/tree/16.x) | [16.12.1](https://www.npmjs.com/package/ng-virtual-list/v/16.12.1) |
741
- | 15.x | 15.12.1 | [15.x](https://github.com/DjonnyX/ng-virtual-list/tree/15.x) | [15.12.1](https://www.npmjs.com/package/ng-virtual-list/v/15.12.1) |
742
- | 14.x | 14.12.1 | [14.x](https://github.com/DjonnyX/ng-virtual-list/tree/14.x) | [14.12.1](https://www.npmjs.com/package/ng-virtual-list/v/14.12.1) |
735
+ | 21.x | 21.12.2 | [20.x](https://github.com/DjonnyX/ng-virtual-list/tree/21.x) | [21.12.2](https://www.npmjs.com/package/ng-virtual-list/v/21.12.2) |
736
+ | 20.x | 20.12.2 | [20.x](https://github.com/DjonnyX/ng-virtual-list/tree/20.x) | [20.12.2](https://www.npmjs.com/package/ng-virtual-list/v/20.12.2) |
737
+ | 19.x | 19.12.2 | [19.x](https://github.com/DjonnyX/ng-virtual-list/tree/19.x) | [19.12.2](https://www.npmjs.com/package/ng-virtual-list/v/19.12.2) |
738
+ | 18.x | 18.12.2 | [18.x](https://github.com/DjonnyX/ng-virtual-list/tree/18.x) | [18.12.2](https://www.npmjs.com/package/ng-virtual-list/v/18.12.2) |
739
+ | 17.x | 17.12.2 | [17.x](https://github.com/DjonnyX/ng-virtual-list/tree/17.x) | [17.12.2](https://www.npmjs.com/package/ng-virtual-list/v/17.12.2) |
740
+ | 16.x | 16.12.2 | [16.x](https://github.com/DjonnyX/ng-virtual-list/tree/16.x) | [16.12.2](https://www.npmjs.com/package/ng-virtual-list/v/16.12.2) |
741
+ | 15.x | 15.12.2 | [15.x](https://github.com/DjonnyX/ng-virtual-list/tree/15.x) | [15.12.2](https://www.npmjs.com/package/ng-virtual-list/v/15.12.2) |
742
+ | 14.x | 14.12.2 | [14.x](https://github.com/DjonnyX/ng-virtual-list/tree/14.x) | [14.12.2](https://www.npmjs.com/package/ng-virtual-list/v/14.12.2) |
743
743
 
744
744
  <br/>
745
745
 
@@ -4051,7 +4051,7 @@ class Animator {
4051
4051
  const SCROLL_VIEW_INVERSION = new InjectionToken('ScrollViewInversion');
4052
4052
  const SCROLL_VIEW_OVERSCROLL_ENABLED = new InjectionToken('ScrollViewOverscrollEnabled');
4053
4053
  const SCROLL_VIEW_NORMALIZE_VALUE_FROM_ZERO = new InjectionToken('ScrollViewNormalizeValueFromZero');
4054
- 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;
4054
+ 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;
4055
4055
  const MAX_ITERATIONS_FOR_AVERAGE_CALCULATIONS = 5, INSTANT_VELOCITY_SCALE = 1000;
4056
4056
  const SCROLL_EVENT$1 = new Event(SCROLLER_SCROLL);
4057
4057
 
@@ -4828,8 +4828,8 @@ class NgScrollView extends BaseScrollView {
4828
4828
  continue;
4829
4829
  }
4830
4830
  if (v00) {
4831
- 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;
4832
- aSum = (aSum * mass) + a0;
4831
+ 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;
4832
+ aSum = Math.abs((aSum * mass)) + Math.abs(a0);
4833
4833
  prevV0 = v01;
4834
4834
  }
4835
4835
  prevV0 = v01;
@@ -4850,7 +4850,7 @@ class NgScrollView extends BaseScrollView {
4850
4850
  }
4851
4851
  moveWithAcceleration(isVertical, position, v0, v, a0, timestamp) {
4852
4852
  if (a0 !== 0 && timestamp < MAX_VELOCITY_TIMESTAMP) {
4853
- 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;
4853
+ 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;
4854
4854
  this.animate(startPosition, Math.round(positionWithVelocity), aDuration, easeOutQuad, true);
4855
4855
  }
4856
4856
  else {
@@ -5329,13 +5329,13 @@ class NgScrollBarComponent extends NgScrollView {
5329
5329
  })).subscribe();
5330
5330
  }
5331
5331
  createDragEvent(userAction) {
5332
- const isVertical = this.isVertical(), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, scrollContent = this.scrollContent()?.nativeElement, scrollViewport = this.scrollViewport()?.nativeElement;
5332
+ 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;
5333
5333
  if (!!scrollViewport && !!scrollContent) {
5334
- const contentSize = isVertical ? scrollContent.offsetHeight : scrollContent.offsetWidth, viewportSize = isVertical ? scrollViewport.offsetHeight : scrollViewport.offsetWidth;
5334
+ 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);
5335
5335
  const event = {
5336
- position: scrollSize !== 0 ? ((isVertical ? this._y : this._x) / scrollSize) : 0,
5337
- min: scrollSize !== 0 ? (this.startOffset() / scrollSize) : 0,
5338
- max: scrollSize !== 0 ? ((viewportSize - this.endOffset() - contentSize) / scrollSize) : 0,
5336
+ position: pos / maxSize,
5337
+ min: scrollSize !== 0 ? (startOffset / scrollSize) : 0,
5338
+ max: scrollSize !== 0 ? ((viewportSize - endOffset - contentSize) / scrollSize) : 0,
5339
5339
  animation: !this._isMoving,
5340
5340
  userAction,
5341
5341
  };