ng-virtual-list 21.12.8 → 21.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, viewChild, signal, ElementRef, DestroyRef, effect, computed, ChangeDetectionStrategy, Component, output, Input, Directive, Injector, InjectionToken, input, ViewChild, ViewContainerRef, ViewEncapsulation, NO_ERRORS_SCHEMA, NgModule } from '@angular/core';
3
- import { Subject, BehaviorSubject, distinctUntilChanged, combineLatest, tap, map, fromEvent, race, of, debounceTime, switchMap as switchMap$1, filter as filter$1, delay, takeUntil as takeUntil$1, startWith, from, take, skip } from 'rxjs';
3
+ import { Subject, BehaviorSubject, distinctUntilChanged, combineLatest, tap, map, fromEvent, race, of, debounceTime, switchMap as switchMap$1, filter as filter$1, delay, takeUntil as takeUntil$1, startWith, take, from, skip } from 'rxjs';
4
4
  import { takeUntilDestroyed, toSignal, toObservable } from '@angular/core/rxjs-interop';
5
5
  import { BehaviorSubject as BehaviorSubject$1 } from 'rxjs/internal/BehaviorSubject';
6
6
  import * as i1 from '@angular/common';
@@ -4155,7 +4155,7 @@ class Animator {
4155
4155
  const SCROLL_VIEW_INVERSION = new InjectionToken('ScrollViewInversion');
4156
4156
  const SCROLL_VIEW_OVERSCROLL_ENABLED = new InjectionToken('ScrollViewOverscrollEnabled');
4157
4157
  const SCROLL_VIEW_NORMALIZE_VALUE_FROM_ZERO = new InjectionToken('ScrollViewNormalizeValueFromZero');
4158
- 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;
4158
+ 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;
4159
4159
  const MAX_ITERATIONS_FOR_AVERAGE_CALCULATIONS = 5, INSTANT_VELOCITY_SCALE = 1000;
4160
4160
  const SCROLL_EVENT$1 = new Event(SCROLLER_SCROLL);
4161
4161
 
@@ -4529,12 +4529,32 @@ class NgScrollView extends BaseScrollView {
4529
4529
  get averageVelocity() { return this._$averageVelocity.getValue(); }
4530
4530
  _measureVelocityTimestamp = Date.now();
4531
4531
  _measureVelocityLastPosition = this.isVertical() ? this._y : this._x;
4532
- _startPosition = 0;
4532
+ _startPositionX = 0;
4533
+ _startPositionY = 0;
4534
+ set startPosition(v) {
4535
+ const isVertical = this.isVertical(), c = isVertical ? this._startPositionY : this._startPositionX;
4536
+ if (v !== c) {
4537
+ if (isVertical) {
4538
+ this._startPositionY = v;
4539
+ }
4540
+ else {
4541
+ this._startPositionX = v;
4542
+ }
4543
+ }
4544
+ }
4545
+ get startPosition() {
4546
+ if (this.isVertical()) {
4547
+ return this._startPositionY;
4548
+ }
4549
+ return this._startPositionX;
4550
+ }
4533
4551
  _animator = new Animator();
4534
4552
  _interactive = true;
4535
4553
  _horizontalAxisInvertion;
4536
4554
  get inverted() { return this._horizontalAxisInvertion(); }
4537
4555
  _overscrollIteration = 0;
4556
+ _overscrollStartIteration = 0;
4557
+ _overscrollApplied = false;
4538
4558
  set x(v) {
4539
4559
  this.setX(v);
4540
4560
  }
@@ -4574,7 +4594,7 @@ class NgScrollView extends BaseScrollView {
4574
4594
  _delta = 0;
4575
4595
  set delta(v) {
4576
4596
  this._delta = v;
4577
- this._startPosition += v;
4597
+ this.startPosition += v;
4578
4598
  }
4579
4599
  set startLayoutOffset(v) {
4580
4600
  if (this._startLayoutOffset !== v) {
@@ -4583,6 +4603,8 @@ class NgScrollView extends BaseScrollView {
4583
4603
  }
4584
4604
  }
4585
4605
  get startLayoutOffset() { return this._startLayoutOffset; }
4606
+ _scrollDirectionValueX = 0;
4607
+ _scrollDirectionValueY = 0;
4586
4608
  _intersectionComponentId = null;
4587
4609
  _isAlignmentAnimation = false;
4588
4610
  get animated() { return this._animator?.isAnimated ?? false; }
@@ -4610,14 +4632,17 @@ class NgScrollView extends BaseScrollView {
4610
4632
  const $wheel = this.$wheel;
4611
4633
  $wheel.pipe(takeUntilDestroyed(), switchMap$1(v => of(this.averageVelocity)), debounceTime(100), tap(v => {
4612
4634
  this.snapWithInitialForceIfNecessary(v);
4635
+ this._overscrollIteration = this._overscrollStartIteration = 0;
4636
+ this._overscrollApplied = false;
4613
4637
  this._scrollDirection.clear();
4638
+ this._scrollDirectionValueX = this._scrollDirectionValueY = 0;
4614
4639
  })).subscribe();
4615
4640
  const $viewport = toObservable(this.scrollViewport).pipe(takeUntilDestroyed(this._destroyRef), filter$1(v => !!v), map(v => v.nativeElement)), $content = toObservable(this.scrollContent).pipe(takeUntilDestroyed(this._destroyRef), filter$1(v => !!v), map(v => v.nativeElement)), $wheelEmitter = this._inversion ? $viewport : $content;
4616
4641
  $wheelEmitter.pipe(takeUntilDestroyed(this._destroyRef), switchMap$1(content => {
4617
4642
  return fromEvent(content, WHEEL, { passive: false }).pipe(filter$1(() => this._interactive), takeUntilDestroyed(this._destroyRef), tap(e => {
4618
4643
  const isVertical = this.isVertical();
4619
4644
  this.emitScrollableEvent();
4620
- this.checkOverscroll(e);
4645
+ this.checkOverscroll(e, true);
4621
4646
  this.stopScrolling(true);
4622
4647
  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);
4623
4648
  this.scroll({ [isVertical ? TOP$1 : LEFT$2]: position, behavior: INSTANT$1, userAction: true, blending: false, fireUpdate: true });
@@ -4660,7 +4685,10 @@ class NgScrollView extends BaseScrollView {
4660
4685
  $content.pipe(takeUntilDestroyed(this._destroyRef), switchMap$1(content => {
4661
4686
  return fromEvent(content, MOUSE_DOWN, { passive: false }).pipe(takeUntilDestroyed(this._destroyRef), filter$1(v => this._interactive), switchMap$1(e => {
4662
4687
  mouseCanceled = false;
4688
+ this._overscrollStartIteration = 0;
4689
+ this._overscrollApplied = false;
4663
4690
  this._scrollDirection.clear();
4691
+ this._scrollDirectionValueX = this._scrollDirectionValueY = 0;
4664
4692
  this.cancelOverscroll();
4665
4693
  this.onDragStart();
4666
4694
  this.stopScrolling(true);
@@ -4672,23 +4700,34 @@ class NgScrollView extends BaseScrollView {
4672
4700
  const inversion = this._inversion, isVertical = this.isVertical();
4673
4701
  this._isMoving = true;
4674
4702
  this.grabbing.set(true);
4675
- this._startPosition = (isVertical ? this.y : this.x);
4676
- let prevClientPosition = (isVertical ? e.clientY : e.clientX) * (this._horizontalAxisInvertion() ? -1 : 1), startClientPos = prevClientPosition, offsets = new Array(), velocities = new Array(), startTime = Date.now();
4703
+ this._startPositionX = this.x;
4704
+ this._startPositionY = this.y;
4705
+ 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();
4677
4706
  return fromEvent(window, MOUSE_MOVE, { passive: false }).pipe(takeUntilDestroyed(this._destroyRef), takeUntil$1($mouseDragCancel), tap(e => {
4678
4707
  this.checkOverscroll(e);
4679
4708
  }), switchMap$1(e => {
4680
- const { position, currentPos, endTime, scrollDelta } = this.calculatePosition(isVertical, e, inversion, startClientPos, startTime, prevClientPosition, offsets, velocities);
4681
- prevClientPosition = currentPos;
4709
+ 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;
4710
+ prevClientPositionX = currentPosX;
4711
+ prevClientPositionY = currentPosY;
4712
+ this._scrollDirectionValueX += Math.abs(scrollDeltaX);
4713
+ this._scrollDirectionValueY += Math.abs(scrollDeltaY);
4682
4714
  this.move(isVertical, position, true, true, true);
4683
- const offset = Math.abs(position) - Math.abs(isVertical ? this._y : this._x), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, viewportSize = isVertical ? this.viewportBounds().height : this.viewportBounds().width;
4684
- if (position >= (scrollSize - viewportSize * .5) || position <= 0) {
4685
- startClientPos -= offset;
4715
+ if (this.isInfinity()) {
4716
+ const offset = Math.abs(position) - Math.abs(isVertical ? this._y : this._x), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, viewportSize = isVertical ? this.viewportBounds().height : this.viewportBounds().width;
4717
+ if (position >= (scrollSize - viewportSize * .5) || position <= 0) {
4718
+ if (isVertical) {
4719
+ startClientPosY -= offset;
4720
+ }
4721
+ else {
4722
+ startClientPosX -= offset;
4723
+ }
4724
+ }
4686
4725
  }
4687
4726
  startTime = endTime;
4688
4727
  return race([fromEvent(window, MOUSE_UP, { passive: false }), fromEvent(content, MOUSE_UP, { passive: false })]).pipe(takeUntilDestroyed(this._destroyRef), takeUntil$1($mouseDragCancel), tap(e => {
4689
4728
  mouseCanceled = true;
4690
4729
  this.cancelOverscroll();
4691
- const endTime = Date.now(), timestamp = endTime - startTime, { v0 } = this.calculateVelocity(offsets, scrollDelta, timestamp), { a0 } = this.calculateAcceleration(velocities, v0, timestamp);
4730
+ 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);
4692
4731
  this._isMoving = false;
4693
4732
  this.grabbing.set(false);
4694
4733
  if (!this.snapIfNecessary(v0, false) && this.scrollBehavior() !== BEHAVIOR_INSTANT) {
@@ -4738,7 +4777,10 @@ class NgScrollView extends BaseScrollView {
4738
4777
  $content.pipe(takeUntilDestroyed(this._destroyRef), switchMap$1(content => {
4739
4778
  return fromEvent(content, TOUCH_START, { passive: false }).pipe(takeUntilDestroyed(this._destroyRef), filter$1(() => this._interactive), switchMap$1(e => {
4740
4779
  touchCanceled = false;
4780
+ this._overscrollStartIteration = 0;
4781
+ this._overscrollApplied = false;
4741
4782
  this._scrollDirection.clear();
4783
+ this._scrollDirectionValueX = this._scrollDirectionValueY = 0;
4742
4784
  this.cancelOverscroll();
4743
4785
  this.onDragStart();
4744
4786
  this.stopScrolling(true);
@@ -4750,23 +4792,34 @@ class NgScrollView extends BaseScrollView {
4750
4792
  const inversion = this._inversion, isVertical = this.isVertical();
4751
4793
  this._isMoving = true;
4752
4794
  this.grabbing.set(true);
4753
- this._startPosition = (isVertical ? this.y : this.x);
4754
- 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();
4795
+ this._startPositionX = this.x;
4796
+ this._startPositionY = this.y;
4797
+ 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();
4755
4798
  return fromEvent(window, TOUCH_MOVE, { passive: false }).pipe(takeUntilDestroyed(this._destroyRef), takeUntil$1($touchCanceler), tap(e => {
4756
4799
  this.checkOverscroll(e);
4757
4800
  }), switchMap$1(e => {
4758
- const { position, currentPos, endTime, scrollDelta } = this.calculatePosition(isVertical, e, inversion, startClientPos, startTime, prevClientPosition, offsets, velocities);
4759
- prevClientPosition = currentPos;
4801
+ 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;
4802
+ prevClientPositionX = currentPosX;
4803
+ prevClientPositionY = currentPosY;
4804
+ this._scrollDirectionValueX += Math.abs(scrollDeltaX);
4805
+ this._scrollDirectionValueY += Math.abs(scrollDeltaY);
4760
4806
  this.move(isVertical, position, true, true, true);
4761
- const offset = Math.abs(position) - Math.abs(isVertical ? this._y : this._x), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, viewportSize = isVertical ? this.viewportBounds().height : this.viewportBounds().width;
4762
- if (position >= (scrollSize - viewportSize * .5) || position <= 0) {
4763
- startClientPos -= offset;
4807
+ if (this.isInfinity()) {
4808
+ const offset = Math.abs(position) - Math.abs(isVertical ? this._y : this._x), scrollSize = isVertical ? this.scrollHeight : this.scrollWidth, viewportSize = isVertical ? this.viewportBounds().height : this.viewportBounds().width;
4809
+ if (position >= (scrollSize - viewportSize * .5) || position <= 0) {
4810
+ if (isVertical) {
4811
+ startClientPosY -= offset;
4812
+ }
4813
+ else {
4814
+ startClientPosX -= offset;
4815
+ }
4816
+ }
4764
4817
  }
4765
4818
  startTime = endTime;
4766
4819
  return race([fromEvent(window, TOUCH_END, { passive: false }), fromEvent(content, TOUCH_END, { passive: false })]).pipe(takeUntilDestroyed(this._destroyRef), takeUntil$1($touchCanceler), tap(e => {
4767
4820
  touchCanceled = true;
4768
4821
  this.cancelOverscroll();
4769
- const endTime = Date.now(), timestamp = endTime - startTime, { v0 } = this.calculateVelocity(offsets, scrollDelta, timestamp), { a0 } = this.calculateAcceleration(velocities, v0, timestamp);
4822
+ 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);
4770
4823
  this._isMoving = false;
4771
4824
  this.grabbing.set(false);
4772
4825
  if (!this.snapIfNecessary(v0, false) && this.scrollBehavior() !== BEHAVIOR_INSTANT) {
@@ -4848,8 +4901,11 @@ class NgScrollView extends BaseScrollView {
4848
4901
  }
4849
4902
  return false;
4850
4903
  }
4851
- calculatePosition(isVertical, e, inversion, startClientPos, startTime, prevClientPosition, offsets, velocities) {
4852
- 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);
4904
+ calculatePosition(isVertical, enabled, axisInversion, e, inversion, startClientPos, startTime, prevClientPosition, offsets, velocities) {
4905
+ if (!enabled) {
4906
+ return { position: isVertical ? this._y : this._x, currentPos: null, endTime: Date.now(), scrollDelta: 0 };
4907
+ }
4908
+ 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);
4853
4909
  this.calculateAcceleration(velocities, v0, timestamp);
4854
4910
  return { position, currentPos, endTime, scrollDelta };
4855
4911
  }
@@ -4878,7 +4934,7 @@ class NgScrollView extends BaseScrollView {
4878
4934
  }
4879
4935
  }
4880
4936
  }
4881
- checkOverscroll(e) {
4937
+ checkOverscroll(e, wheel = false) {
4882
4938
  if (!this._overscrollEnabled || !this.overscrollEnabled()) {
4883
4939
  if (e.cancelable) {
4884
4940
  e.stopImmediatePropagation();
@@ -4888,14 +4944,35 @@ class NgScrollView extends BaseScrollView {
4888
4944
  }
4889
4945
  if (this._overscrollEnabled) {
4890
4946
  if (this.isVertical()) {
4891
- this.checkOverscrollByAxis(e, this._y, this.scrollHeight);
4947
+ if (this._overscrollStartIteration < OVERSCROLL_START_ITERATION) {
4948
+ this._overscrollStartIteration++;
4949
+ this.checkOverscrollByAxis(e, this._y, this.scrollHeight);
4950
+ }
4951
+ else {
4952
+ if (wheel || this._overscrollApplied || this._scrollDirectionValueY > this._scrollDirectionValueX) {
4953
+ this._overscrollApplied = true;
4954
+ this.checkOverscrollByAxis(e, this._y, this.scrollHeight);
4955
+ }
4956
+ }
4892
4957
  }
4893
4958
  else {
4894
- this.checkOverscrollByAxis(e, this._x, this.scrollWidth);
4959
+ if (this._overscrollStartIteration < OVERSCROLL_START_ITERATION) {
4960
+ this._overscrollStartIteration++;
4961
+ this.checkOverscrollByAxis(e, this._x, this.scrollWidth);
4962
+ }
4963
+ else {
4964
+ if (wheel || this._overscrollApplied || this._scrollDirectionValueX > this._scrollDirectionValueY) {
4965
+ this._overscrollApplied = true;
4966
+ this.checkOverscrollByAxis(e, this._x, this.scrollWidth);
4967
+ }
4968
+ }
4895
4969
  }
4896
4970
  }
4897
4971
  }
4898
4972
  calculateVelocity(offsets, delta, timestamp, indexOffset = 10) {
4973
+ if (offsets.length > MAX_VELOCITIES_LENGTH) {
4974
+ offsets.shift();
4975
+ }
4899
4976
  offsets.push([delta, timestamp < ANIMATOR_MIN_TIMESTAMP ? ANIMATOR_MIN_TIMESTAMP : timestamp]);
4900
4977
  const len = offsets.length, startIndex = len > indexOffset ? len - indexOffset : 0, lastVSign = calculateDirection(offsets), speedScale = this.scrollingSettings()?.speedScale ?? SPEED_SCALE;
4901
4978
  let vSum = 0;
@@ -4911,7 +4988,10 @@ class NgScrollView extends BaseScrollView {
4911
4988
  return { v0 };
4912
4989
  }
4913
4990
  calculateAcceleration(velocities, delta, timestamp, indexOffset = 10) {
4914
- velocities.push([delta, timestamp < ANIMATOR_MIN_TIMESTAMP ? ANIMATOR_MIN_TIMESTAMP : timestamp]);
4991
+ if (velocities.length > MAX_VELOCITIES_LENGTH) {
4992
+ velocities.shift();
4993
+ }
4994
+ velocities.push([Math.abs(delta) < MIN_DELTA ? 0 : delta, timestamp < ANIMATOR_MIN_TIMESTAMP ? ANIMATOR_MIN_TIMESTAMP : timestamp]);
4915
4995
  const len = velocities.length, startIndex = len > indexOffset ? len - indexOffset : 0;
4916
4996
  let aSum = 0, prevV0, iteration = 0, lastVSign = calculateDirection(velocities);
4917
4997
  const mass = this.scrollingSettings()?.mass ?? MASS;
@@ -4929,7 +5009,7 @@ class NgScrollView extends BaseScrollView {
4929
5009
  iteration++;
4930
5010
  }
4931
5011
  const a0 = aSum * (this.scrollingSettings()?.frictionalForce ?? FRICTION_FORCE);
4932
- return { a0 };
5012
+ return { a0: Math.abs(a0) < MIN_ACCELERATION ? 0 : a0 };
4933
5013
  }
4934
5014
  stopScrolling(force = false) {
4935
5015
  if (this._isAlignmentAnimation && !force) {
@@ -5596,6 +5676,13 @@ class NgScrollerComponent extends NgScrollView {
5596
5676
  super();
5597
5677
  this._filterId = `${this._service.id}-${MOTION_BLUR}`;
5598
5678
  this._filter = `url(#${this._filterId})`;
5679
+ this.$resizeViewport.pipe(takeUntilDestroyed(), debounceTime(0), tap(() => {
5680
+ this.snapIfNeed();
5681
+ }), switchMap$1(() => {
5682
+ return this.$scroll.pipe(takeUntilDestroyed(this._destroyRef), take(1), tap(() => {
5683
+ this.snapIfNeed();
5684
+ }));
5685
+ })).subscribe();
5599
5686
  const $filter = toObservable(this.filter), $motionBlur = toObservable(this.motionBlur), $maxMotionBlur = toObservable(this.maxMotionBlur), $motionBlurEnabled = toObservable(this.motionBlurEnabled), $isVertical = toObservable(this.isVertical);
5600
5687
  const $scrollbarScroll = this.$scrollbarScroll;
5601
5688
  $scrollbarScroll.pipe(takeUntilDestroyed(), debounceTime(50), tap(() => {
@@ -7595,7 +7682,7 @@ class NgVirtualListComponent {
7595
7682
  this._trackBox.preventScrollSnapping(true);
7596
7683
  const params = {
7597
7684
  [this._isVertical ? TOP_PROP_NAME : LEFT_PROP_NAME]: pos, behavior, snap: false, normalize: true,
7598
- fireUpdate: false, blending: false, userAction: false,
7685
+ fireUpdate: true, blending: false, userAction: false,
7599
7686
  duration: this.snapToItem() ? Math.max(this.animationParams().scrollToItem, this.animationParams().navigateToItem) : this.animationParams().navigateToItem,
7600
7687
  };
7601
7688
  scroller.scrollTo(params);