@revolist/revogrid 3.6.0 → 3.6.1

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.
@@ -270,15 +270,17 @@ class ViewportStore {
270
270
  const outsize = frameOffset * 2 * dimension.originItemSize;
271
271
  virtualSize += outsize;
272
272
  let maxCoordinate = virtualSize;
273
+ // if real size is bigger than virtual size, then the end will be real size decreased by virtual size
274
+ // but sometimes the real size slightly bigger than virtual size, so we need to check it and fallback max coordinate to virtual size
273
275
  if (dimension.realSize > virtualSize) {
274
- maxCoordinate = dimension.realSize - virtualSize;
276
+ maxCoordinate = Math.max(dimension.realSize - virtualSize, virtualSize);
275
277
  }
276
278
  let toUpdate = {
277
279
  lastCoordinate: position,
278
280
  };
279
281
  let pos = position;
280
282
  pos -= frameOffset * dimension.originItemSize;
281
- pos = pos < 0 ? 0 : pos < maxCoordinate ? pos : maxCoordinate;
283
+ pos = pos < 0 ? 0 : pos < maxCoordinate ? pos : maxCoordinate; // todo: check if maxCoordinate can be removed
282
284
  const firstItem = getFirstItem(this.getItems());
283
285
  const lastItem = getLastItem(this.getItems());
284
286
  // left position changed
@@ -4767,15 +4767,17 @@ class ViewportStore {
4767
4767
  const outsize = frameOffset * 2 * dimension.originItemSize;
4768
4768
  virtualSize += outsize;
4769
4769
  let maxCoordinate = virtualSize;
4770
+ // if real size is bigger than virtual size, then the end will be real size decreased by virtual size
4771
+ // but sometimes the real size slightly bigger than virtual size, so we need to check it and fallback max coordinate to virtual size
4770
4772
  if (dimension.realSize > virtualSize) {
4771
- maxCoordinate = dimension.realSize - virtualSize;
4773
+ maxCoordinate = Math.max(dimension.realSize - virtualSize, virtualSize);
4772
4774
  }
4773
4775
  let toUpdate = {
4774
4776
  lastCoordinate: position,
4775
4777
  };
4776
4778
  let pos = position;
4777
4779
  pos -= frameOffset * dimension.originItemSize;
4778
- pos = pos < 0 ? 0 : pos < maxCoordinate ? pos : maxCoordinate;
4780
+ pos = pos < 0 ? 0 : pos < maxCoordinate ? pos : maxCoordinate; // todo: check if maxCoordinate can be removed
4779
4781
  const firstItem = getFirstItem(this.getItems());
4780
4782
  const lastItem = getLastItem(this.getItems());
4781
4783
  // left position changed
@@ -40,15 +40,17 @@ export default class ViewportStore {
40
40
  const outsize = frameOffset * 2 * dimension.originItemSize;
41
41
  virtualSize += outsize;
42
42
  let maxCoordinate = virtualSize;
43
+ // if real size is bigger than virtual size, then the end will be real size decreased by virtual size
44
+ // but sometimes the real size slightly bigger than virtual size, so we need to check it and fallback max coordinate to virtual size
43
45
  if (dimension.realSize > virtualSize) {
44
- maxCoordinate = dimension.realSize - virtualSize;
46
+ maxCoordinate = Math.max(dimension.realSize - virtualSize, virtualSize);
45
47
  }
46
48
  let toUpdate = {
47
49
  lastCoordinate: position,
48
50
  };
49
51
  let pos = position;
50
52
  pos -= frameOffset * dimension.originItemSize;
51
- pos = pos < 0 ? 0 : pos < maxCoordinate ? pos : maxCoordinate;
53
+ pos = pos < 0 ? 0 : pos < maxCoordinate ? pos : maxCoordinate; // todo: check if maxCoordinate can be removed
52
54
  const firstItem = getFirstItem(this.getItems());
53
55
  const lastItem = getLastItem(this.getItems());
54
56
  // left position changed
@@ -4763,15 +4763,17 @@ class ViewportStore {
4763
4763
  const outsize = frameOffset * 2 * dimension.originItemSize;
4764
4764
  virtualSize += outsize;
4765
4765
  let maxCoordinate = virtualSize;
4766
+ // if real size is bigger than virtual size, then the end will be real size decreased by virtual size
4767
+ // but sometimes the real size slightly bigger than virtual size, so we need to check it and fallback max coordinate to virtual size
4766
4768
  if (dimension.realSize > virtualSize) {
4767
- maxCoordinate = dimension.realSize - virtualSize;
4769
+ maxCoordinate = Math.max(dimension.realSize - virtualSize, virtualSize);
4768
4770
  }
4769
4771
  let toUpdate = {
4770
4772
  lastCoordinate: position,
4771
4773
  };
4772
4774
  let pos = position;
4773
4775
  pos -= frameOffset * dimension.originItemSize;
4774
- pos = pos < 0 ? 0 : pos < maxCoordinate ? pos : maxCoordinate;
4776
+ pos = pos < 0 ? 0 : pos < maxCoordinate ? pos : maxCoordinate; // todo: check if maxCoordinate can be removed
4775
4777
  const firstItem = getFirstItem(this.getItems());
4776
4778
  const lastItem = getLastItem(this.getItems());
4777
4779
  // left position changed