ng-virtual-list 16.12.8 → 16.12.9

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.
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, inject, Component, ChangeDetectorRef, ElementRef, ChangeDetectionStrategy, ViewChild, EventEmitter as EventEmitter$1, Directive, Input, Output, Injector, InjectionToken, TemplateRef, ViewContainerRef, ViewEncapsulation, NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
3
- import { Subject, BehaviorSubject, takeUntil, distinctUntilChanged, combineLatest, tap, map, fromEvent, race, of, debounceTime, switchMap as switchMap$1, filter as filter$1, delay, startWith, from, take, skip } from 'rxjs';
3
+ import { Subject, BehaviorSubject, takeUntil, distinctUntilChanged, combineLatest, tap, map, fromEvent, race, of, debounceTime, switchMap as switchMap$1, filter as filter$1, delay, startWith, take, from, skip } from 'rxjs';
4
4
  import { BehaviorSubject as BehaviorSubject$1 } from 'rxjs/internal/BehaviorSubject';
5
5
  import * as i1 from '@angular/common';
6
6
  import { CommonModule } from '@angular/common';
@@ -4071,7 +4071,7 @@ class Animator {
4071
4071
  const SCROLL_VIEW_INVERSION = new InjectionToken('ScrollViewInversion');
4072
4072
  const SCROLL_VIEW_OVERSCROLL_ENABLED = new InjectionToken('ScrollViewOverscrollEnabled');
4073
4073
  const SCROLL_VIEW_NORMALIZE_VALUE_FROM_ZERO = new InjectionToken('ScrollViewNormalizeValueFromZero');
4074
- const TOP$1 = 'top', LEFT$2 = '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;
4074
+ const TOP$1 = 'top', LEFT$2 = '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, MIN_DELTA = 0.1, MAX_VELOCITY_TIMESTAMP = 100, MAX_VELOCITIES_LENGTH = 10, MIN_ACCELERATION = 0.001, SPEED_SCALE = 15, OVERSCROLL_START_ITERATION = 2;
4075
4075
  const MAX_ITERATIONS_FOR_AVERAGE_CALCULATIONS = 5, INSTANT_VELOCITY_SCALE = 1000;
4076
4076
  const SCROLL_EVENT$1 = new Event(SCROLLER_SCROLL);
4077
4077
 
@@ -4607,7 +4607,25 @@ class NgScrollView extends BaseScrollView {
4607
4607
  get averageVelocity() { return this._$averageVelocity.getValue(); }
4608
4608
  _measureVelocityTimestamp = Date.now();
4609
4609
  _measureVelocityLastPosition = this._$isVertical.getValue() ? this._y : this._x;
4610
- _startPosition = 0;
4610
+ _startPositionX = 0;
4611
+ _startPositionY = 0;
4612
+ set startPosition(v) {
4613
+ const isVertical = this._$isVertical.getValue(), c = isVertical ? this._startPositionY : this._startPositionX;
4614
+ if (v !== c) {
4615
+ if (isVertical) {
4616
+ this._startPositionY = v;
4617
+ }
4618
+ else {
4619
+ this._startPositionX = v;
4620
+ }
4621
+ }
4622
+ }
4623
+ get startPosition() {
4624
+ if (this._$isVertical.getValue()) {
4625
+ return this._startPositionY;
4626
+ }
4627
+ return this._startPositionX;
4628
+ }
4611
4629
  _animator = new Animator();
4612
4630
  _$horizontalAxisInvertion = new BehaviorSubject(false);
4613
4631
  $horizontalAxisInvertion = this._$horizontalAxisInvertion.asObservable();
@@ -4615,6 +4633,8 @@ class NgScrollView extends BaseScrollView {
4615
4633
  get inverted() { return this._$horizontalAxisInvertion.getValue(); }
4616
4634
  _interactive = true;
4617
4635
  _overscrollIteration = 0;
4636
+ _overscrollStartIteration = 0;
4637
+ _overscrollApplied = false;
4618
4638
  set x(v) {
4619
4639
  this.setX(v);
4620
4640
  }
@@ -4654,7 +4674,7 @@ class NgScrollView extends BaseScrollView {
4654
4674
  _delta = 0;
4655
4675
  set delta(v) {
4656
4676
  this._delta = v;
4657
- this._startPosition += v;
4677
+ this.startPosition += v;
4658
4678
  }
4659
4679
  set startLayoutOffset(v) {
4660
4680
  if (this._startLayoutOffset !== v) {
@@ -4663,6 +4683,8 @@ class NgScrollView extends BaseScrollView {
4663
4683
  }
4664
4684
  }
4665
4685
  get startLayoutOffset() { return this._startLayoutOffset; }
4686
+ _scrollDirectionValueX = 0;
4687
+ _scrollDirectionValueY = 0;
4666
4688
  _intersectionComponentId = null;
4667
4689
  _isAlignmentAnimation = false;
4668
4690
  get animated() { return this._animator?.isAnimated ?? false; }
@@ -4694,14 +4716,17 @@ class NgScrollView extends BaseScrollView {
4694
4716
  }), switchMap$1(v => of(this.averageVelocity)), debounceTime(100), tap(v => {
4695
4717
  this._$grabbing.next(false);
4696
4718
  this.snapWithInitialForceIfNecessary(v);
4719
+ this._overscrollIteration = this._overscrollStartIteration = 0;
4720
+ this._overscrollApplied = false;
4697
4721
  this._scrollDirection.clear();
4722
+ this._scrollDirectionValueX = this._scrollDirectionValueY = 0;
4698
4723
  })).subscribe();
4699
4724
  const $viewport = of(this.scrollViewport).pipe(takeUntil(this._$unsubscribe), filter$1(v => !!v), map(v => v.nativeElement)), $content = of(this.scrollContent).pipe(takeUntil(this._$unsubscribe), filter$1(v => !!v), map(v => v.nativeElement)), $wheelEmitter = this._inversion ? $viewport : $content;
4700
4725
  $wheelEmitter.pipe(takeUntil(this._$unsubscribe), switchMap$1(content => {
4701
4726
  return fromEvent(content, WHEEL, { passive: false }).pipe(filter$1(() => this._interactive), takeUntil(this._$unsubscribe), tap(e => {
4702
4727
  const isVertical = this._$isVertical.getValue();
4703
4728
  this.emitScrollableEvent();
4704
- this.checkOverscroll(e);
4729
+ this.checkOverscroll(e, true);
4705
4730
  this.stopScrolling(true);
4706
4731
  const scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, startPos = isVertical ? this._y : this._x, delta = isVertical ? e.deltaY : (e.deltaX * (this.horizontalAxisInvertion ? -1 : 1)), dp = (startPos + delta), position = this.isInfinity ? dp : (dp < 0 ? 0 : dp > scrollSize ? scrollSize : dp);
4707
4732
  this.scroll({ [isVertical ? TOP$1 : LEFT$2]: position, behavior: INSTANT$1, userAction: true, blending: false, fireUpdate: true });
@@ -4744,7 +4769,10 @@ class NgScrollView extends BaseScrollView {
4744
4769
  $content.pipe(takeUntil(this._$unsubscribe), switchMap$1(content => {
4745
4770
  return fromEvent(content, MOUSE_DOWN, { passive: false }).pipe(takeUntil(this._$unsubscribe), filter$1(v => this._interactive), switchMap$1(e => {
4746
4771
  mouseCanceled = false;
4772
+ this._overscrollStartIteration = 0;
4773
+ this._overscrollApplied = false;
4747
4774
  this._scrollDirection.clear();
4775
+ this._scrollDirectionValueX = this._scrollDirectionValueY = 0;
4748
4776
  this.cancelOverscroll();
4749
4777
  this.onDragStart();
4750
4778
  this.stopScrolling(true);
@@ -4756,23 +4784,34 @@ class NgScrollView extends BaseScrollView {
4756
4784
  const inversion = this._inversion, isVertical = this._$isVertical.getValue();
4757
4785
  this._isMoving = true;
4758
4786
  this._$grabbing.next(true);
4759
- this._startPosition = (isVertical ? this.y : this.x);
4760
- let prevClientPosition = (isVertical ? e.clientY : e.clientX) * (this.horizontalAxisInvertion ? -1 : 1), startClientPos = prevClientPosition, offsets = new Array(), velocities = new Array(), startTime = Date.now();
4787
+ this._startPositionX = this.x;
4788
+ this._startPositionY = this.y;
4789
+ let prevClientPositionX = (e.clientX) * (this.horizontalAxisInvertion ? -1 : 1), prevClientPositionY = e.clientY, startClientPosX = prevClientPositionX, startClientPosY = prevClientPositionY, offsetsX = new Array(), offsetsY = new Array(), velocitiesX = new Array(), velocitiesY = new Array(), startTime = Date.now();
4761
4790
  return fromEvent(window, MOUSE_MOVE, { passive: false }).pipe(takeUntil(this._$unsubscribe), takeUntil($mouseDragCancel), tap(e => {
4762
4791
  this.checkOverscroll(e);
4763
4792
  }), switchMap$1(e => {
4764
- const { position, currentPos, endTime, scrollDelta } = this.calculatePosition(isVertical, e, inversion, startClientPos, startTime, prevClientPosition, offsets, velocities);
4765
- prevClientPosition = currentPos;
4793
+ const { position: positionX, currentPos: currentPosX, endTime, scrollDelta: scrollDeltaX } = this.calculatePosition(false, true, this.horizontalAxisInvertion, e, inversion, startClientPosX, startTime, prevClientPositionX, offsetsX, velocitiesX), { position: positionY, currentPos: currentPosY, scrollDelta: scrollDeltaY } = this.calculatePosition(true, true, false, e, inversion, startClientPosY, startTime, prevClientPositionY, offsetsY, velocitiesY), position = isVertical ? positionY : positionX;
4794
+ prevClientPositionX = currentPosX;
4795
+ prevClientPositionY = currentPosY;
4796
+ this._scrollDirectionValueX += Math.abs(scrollDeltaX);
4797
+ this._scrollDirectionValueY += Math.abs(scrollDeltaY);
4766
4798
  this.move(isVertical, position, true, true, true);
4767
- const offset = Math.abs(position) - Math.abs(isVertical ? this._y : this._x), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, viewportSize = isVertical ? this._$viewportBounds.getValue().height : this._$viewportBounds.getValue().width;
4768
- if (position >= (scrollSize - viewportSize * .5) || position <= 0) {
4769
- startClientPos -= offset;
4799
+ if (this.isInfinity) {
4800
+ const offset = Math.abs(position) - Math.abs(isVertical ? this._y : this._x), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, viewportSize = isVertical ? this._$viewportBounds.getValue().height : this._$viewportBounds.getValue().width;
4801
+ if (position >= (scrollSize - viewportSize * .5) || position <= 0) {
4802
+ if (isVertical) {
4803
+ startClientPosY -= offset;
4804
+ }
4805
+ else {
4806
+ startClientPosX -= offset;
4807
+ }
4808
+ }
4770
4809
  }
4771
4810
  startTime = endTime;
4772
4811
  return race([fromEvent(window, MOUSE_UP, { passive: false }), fromEvent(content, MOUSE_UP, { passive: false })]).pipe(takeUntil(this._$unsubscribe), takeUntil($mouseDragCancel), tap(e => {
4773
4812
  mouseCanceled = true;
4774
4813
  this.cancelOverscroll();
4775
- const endTime = Date.now(), timestamp = endTime - startTime, { v0 } = this.calculateVelocity(offsets, scrollDelta, timestamp), { a0 } = this.calculateAcceleration(velocities, v0, timestamp);
4814
+ const endTime = Date.now(), timestamp = endTime - startTime, { v0 } = this.calculateVelocity(isVertical ? offsetsY : offsetsX, isVertical ? scrollDeltaY : scrollDeltaX, timestamp), { a0 } = this.calculateAcceleration(isVertical ? velocitiesY : velocitiesX, v0, timestamp);
4776
4815
  this._isMoving = false;
4777
4816
  this._$grabbing.next(false);
4778
4817
  if (!this.snapIfNecessary(v0, false) && this.scrollBehavior !== BEHAVIOR_INSTANT) {
@@ -4822,7 +4861,10 @@ class NgScrollView extends BaseScrollView {
4822
4861
  $content.pipe(takeUntil(this._$unsubscribe), switchMap$1(content => {
4823
4862
  return fromEvent(content, TOUCH_START, { passive: false }).pipe(takeUntil(this._$unsubscribe), filter$1(() => this._interactive), switchMap$1(e => {
4824
4863
  touchCanceled = false;
4864
+ this._overscrollStartIteration = 0;
4865
+ this._overscrollApplied = false;
4825
4866
  this._scrollDirection.clear();
4867
+ this._scrollDirectionValueX = this._scrollDirectionValueY = 0;
4826
4868
  this.cancelOverscroll();
4827
4869
  this.onDragStart();
4828
4870
  this.stopScrolling(true);
@@ -4834,23 +4876,34 @@ class NgScrollView extends BaseScrollView {
4834
4876
  const inversion = this._inversion, isVertical = this._$isVertical.getValue();
4835
4877
  this._isMoving = true;
4836
4878
  this._$grabbing.next(true);
4837
- this._startPosition = (isVertical ? this.y : this.x);
4838
- let prevClientPosition = (isVertical ? e.touches[e.touches.length - 1].clientY : e.touches[e.touches.length - 1].clientX) * (this.horizontalAxisInvertion ? -1 : 1), startClientPos = prevClientPosition, offsets = new Array(), velocities = new Array(), startTime = Date.now();
4879
+ this._startPositionX = this.x;
4880
+ this._startPositionY = this.y;
4881
+ let prevClientPositionX = (e.touches[e.touches.length - 1].clientX) * (this.horizontalAxisInvertion ? -1 : 1), prevClientPositionY = e.touches[e.touches.length - 1].clientY, startClientPosX = prevClientPositionX, startClientPosY = prevClientPositionY, offsetsX = new Array(), offsetsY = new Array(), velocitiesX = new Array(), velocitiesY = new Array(), startTime = Date.now();
4839
4882
  return fromEvent(window, TOUCH_MOVE, { passive: false }).pipe(takeUntil(this._$unsubscribe), takeUntil($touchCanceler), tap(e => {
4840
4883
  this.checkOverscroll(e);
4841
4884
  }), switchMap$1(e => {
4842
- const { position, currentPos, endTime, scrollDelta } = this.calculatePosition(isVertical, e, inversion, startClientPos, startTime, prevClientPosition, offsets, velocities);
4843
- prevClientPosition = currentPos;
4885
+ const { position: positionX, currentPos: currentPosX, endTime, scrollDelta: scrollDeltaX } = this.calculatePosition(false, true, this.horizontalAxisInvertion, e, inversion, startClientPosX, startTime, prevClientPositionX, offsetsX, velocitiesX), { position: positionY, currentPos: currentPosY, scrollDelta: scrollDeltaY } = this.calculatePosition(true, true, false, e, inversion, startClientPosY, startTime, prevClientPositionY, offsetsY, velocitiesY), position = isVertical ? positionY : positionX;
4886
+ prevClientPositionX = currentPosX;
4887
+ prevClientPositionY = currentPosY;
4888
+ this._scrollDirectionValueX += Math.abs(scrollDeltaX);
4889
+ this._scrollDirectionValueY += Math.abs(scrollDeltaY);
4844
4890
  this.move(isVertical, position, true, true, true);
4845
- const offset = Math.abs(position) - Math.abs(isVertical ? this._y : this._x), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, viewportSize = isVertical ? this._$viewportBounds.getValue().height : this._$viewportBounds.getValue().width;
4846
- if (position >= (scrollSize - viewportSize * .5) || position <= 0) {
4847
- startClientPos -= offset;
4891
+ if (this.isInfinity) {
4892
+ const offset = Math.abs(position) - Math.abs(isVertical ? this._y : this._x), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, viewportSize = isVertical ? this._$viewportBounds.getValue().height : this._$viewportBounds.getValue().width;
4893
+ if (position >= (scrollSize - viewportSize * .5) || position <= 0) {
4894
+ if (isVertical) {
4895
+ startClientPosY -= offset;
4896
+ }
4897
+ else {
4898
+ startClientPosX -= offset;
4899
+ }
4900
+ }
4848
4901
  }
4849
4902
  startTime = endTime;
4850
4903
  return race([fromEvent(window, TOUCH_END, { passive: false }), fromEvent(content, TOUCH_END, { passive: false })]).pipe(takeUntil(this._$unsubscribe), takeUntil($touchCanceler), tap(e => {
4851
4904
  touchCanceled = true;
4852
4905
  this.cancelOverscroll();
4853
- const endTime = Date.now(), timestamp = endTime - startTime, { v0 } = this.calculateVelocity(offsets, scrollDelta, timestamp), { a0 } = this.calculateAcceleration(velocities, v0, timestamp);
4906
+ const endTime = Date.now(), timestamp = endTime - startTime, { v0 } = this.calculateVelocity(isVertical ? offsetsY : offsetsX, isVertical ? scrollDeltaY : scrollDeltaX, timestamp), { a0 } = this.calculateAcceleration(isVertical ? velocitiesY : velocitiesX, v0, timestamp);
4854
4907
  this._isMoving = false;
4855
4908
  this._$grabbing.next(false);
4856
4909
  if (!this.snapIfNecessary(v0, false) && this.scrollBehavior !== BEHAVIOR_INSTANT) {
@@ -4932,8 +4985,11 @@ class NgScrollView extends BaseScrollView {
4932
4985
  }
4933
4986
  return false;
4934
4987
  }
4935
- calculatePosition(isVertical, e, inversion, startClientPos, startTime, prevClientPosition, offsets, velocities) {
4936
- const currentPos = (isVertical ? e.touches?.[e.touches?.length - 1]?.clientY || e.clientY : e.touches?.[e.touches?.length - 1]?.clientX || e.clientX) * (this.horizontalAxisInvertion ? -1 : 1), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, delta = (inversion ? -1 : 1) * (startClientPos - currentPos), dp = this._startPosition + delta, position = this.isInfinity ? dp : dp < 0 ? 0 : dp > scrollSize ? scrollSize : dp, endTime = Date.now(), timestamp = endTime - startTime, scrollDelta = prevClientPosition === 0 ? 0 : prevClientPosition - currentPos, { v0 } = this.calculateVelocity(offsets, scrollDelta, timestamp);
4988
+ calculatePosition(isVertical, enabled, axisInversion, e, inversion, startClientPos, startTime, prevClientPosition, offsets, velocities) {
4989
+ if (!enabled) {
4990
+ return { position: isVertical ? this._y : this._x, currentPos: null, endTime: Date.now(), scrollDelta: 0 };
4991
+ }
4992
+ const currentPos = (isVertical ? e.touches?.[e.touches?.length - 1]?.clientY || e.clientY : e.touches?.[e.touches?.length - 1]?.clientX || e.clientX) * (axisInversion ? -1 : 1), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, delta = (inversion ? -1 : 1) * (startClientPos - currentPos), dp = (isVertical ? this._startPositionY : this._startPositionX) + delta, position = this.isInfinity ? dp : dp < 0 ? 0 : dp > scrollSize ? scrollSize : dp, endTime = Date.now(), timestamp = endTime - startTime, scrollDelta = (prevClientPosition === 0 || prevClientPosition === null) ? 0 : prevClientPosition - currentPos, { v0 } = this.calculateVelocity(offsets, scrollDelta, timestamp);
4937
4993
  this.calculateAcceleration(velocities, v0, timestamp);
4938
4994
  return { position, currentPos, endTime, scrollDelta };
4939
4995
  }
@@ -4962,7 +5018,7 @@ class NgScrollView extends BaseScrollView {
4962
5018
  }
4963
5019
  }
4964
5020
  }
4965
- checkOverscroll(e) {
5021
+ checkOverscroll(e, wheel = false) {
4966
5022
  if (!this._overscrollEnabled || !this.overscrollEnabled) {
4967
5023
  if (e.cancelable) {
4968
5024
  e.stopImmediatePropagation();
@@ -4972,14 +5028,35 @@ class NgScrollView extends BaseScrollView {
4972
5028
  }
4973
5029
  if (this._overscrollEnabled) {
4974
5030
  if (this._$isVertical.getValue()) {
4975
- this.checkOverscrollByAxis(e, this._y, this.scrollHeight);
5031
+ if (this._overscrollStartIteration < OVERSCROLL_START_ITERATION) {
5032
+ this._overscrollStartIteration++;
5033
+ this.checkOverscrollByAxis(e, this._y, this.scrollHeight);
5034
+ }
5035
+ else {
5036
+ if (wheel || this._overscrollApplied || this._scrollDirectionValueY > this._scrollDirectionValueX) {
5037
+ this._overscrollApplied = true;
5038
+ this.checkOverscrollByAxis(e, this._y, this.scrollHeight);
5039
+ }
5040
+ }
4976
5041
  }
4977
5042
  else {
4978
- this.checkOverscrollByAxis(e, this._x, this.scrollWidth);
5043
+ if (this._overscrollStartIteration < OVERSCROLL_START_ITERATION) {
5044
+ this._overscrollStartIteration++;
5045
+ this.checkOverscrollByAxis(e, this._x, this.scrollWidth);
5046
+ }
5047
+ else {
5048
+ if (wheel || this._overscrollApplied || this._scrollDirectionValueX > this._scrollDirectionValueY) {
5049
+ this._overscrollApplied = true;
5050
+ this.checkOverscrollByAxis(e, this._x, this.scrollWidth);
5051
+ }
5052
+ }
4979
5053
  }
4980
5054
  }
4981
5055
  }
4982
5056
  calculateVelocity(offsets, delta, timestamp, indexOffset = 10) {
5057
+ if (offsets.length > MAX_VELOCITIES_LENGTH) {
5058
+ offsets.shift();
5059
+ }
4983
5060
  offsets.push([delta, timestamp < ANIMATOR_MIN_TIMESTAMP ? ANIMATOR_MIN_TIMESTAMP : timestamp]);
4984
5061
  const len = offsets.length, startIndex = len > indexOffset ? len - indexOffset : 0, lastVSign = calculateDirection(offsets), speedScale = this.scrollingSettings?.speedScale ?? SPEED_SCALE;
4985
5062
  let vSum = 0;
@@ -4995,7 +5072,10 @@ class NgScrollView extends BaseScrollView {
4995
5072
  return { v0 };
4996
5073
  }
4997
5074
  calculateAcceleration(velocities, delta, timestamp, indexOffset = 10) {
4998
- velocities.push([delta, timestamp < ANIMATOR_MIN_TIMESTAMP ? ANIMATOR_MIN_TIMESTAMP : timestamp]);
5075
+ if (velocities.length > MAX_VELOCITIES_LENGTH) {
5076
+ velocities.shift();
5077
+ }
5078
+ velocities.push([Math.abs(delta) < MIN_DELTA ? 0 : delta, timestamp < ANIMATOR_MIN_TIMESTAMP ? ANIMATOR_MIN_TIMESTAMP : timestamp]);
4999
5079
  const len = velocities.length, startIndex = len > indexOffset ? len - indexOffset : 0;
5000
5080
  let aSum = 0, prevV0, iteration = 0, lastVSign = calculateDirection(velocities);
5001
5081
  const mass = this.scrollingSettings?.mass ?? MASS;
@@ -5013,7 +5093,7 @@ class NgScrollView extends BaseScrollView {
5013
5093
  iteration++;
5014
5094
  }
5015
5095
  const a0 = aSum * (this.scrollingSettings?.frictionalForce ?? FRICTION_FORCE);
5016
- return { a0 };
5096
+ return { a0: Math.abs(a0) < MIN_ACCELERATION ? 0 : a0 };
5017
5097
  }
5018
5098
  stopScrolling(force = false) {
5019
5099
  if (this._isAlignmentAnimation && !force) {
@@ -5960,6 +6040,13 @@ class NgScrollerComponent extends NgScrollView {
5960
6040
  }
5961
6041
  ngAfterViewInit() {
5962
6042
  super.ngAfterViewInit();
6043
+ this.$resizeViewport.pipe(takeUntil(this._$unsubscribe), debounceTime(0), tap(() => {
6044
+ this.snapIfNeed();
6045
+ }), switchMap$1(() => {
6046
+ return this.$scroll.pipe(takeUntil(this._$unsubscribe), take(1), tap(() => {
6047
+ this.snapIfNeed();
6048
+ }));
6049
+ })).subscribe();
5963
6050
  const $filter = of(this.filter), $motionBlur = this.$motionBlur, $maxMotionBlur = this.$maxMotionBlur, $motionBlurEnabled = this.$motionBlurEnabled, $isVertical = this.$isVertical;
5964
6051
  const $scrollbarScroll = this.$scrollbarScroll;
5965
6052
  $scrollbarScroll.pipe(takeUntil(this._$unsubscribe), debounceTime(50), tap(() => {
@@ -8785,7 +8872,7 @@ class NgVirtualListComponent extends DisposableComponent {
8785
8872
  this._trackBox.preventScrollSnapping(true);
8786
8873
  const params = {
8787
8874
  [this._isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: pos, behavior, snap: false, normalize: true,
8788
- fireUpdate: false, blending: false, userAction: false,
8875
+ fireUpdate: true, blending: false, userAction: false,
8789
8876
  duration: this.snapToItem ? Math.max(this.animationParams.scrollToItem, this.animationParams.navigateToItem) : this.animationParams.navigateToItem,
8790
8877
  };
8791
8878
  scroller.scrollTo(params);