@pdanpdan/virtual-scroll 0.10.1 → 0.10.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pdanpdan/virtual-scroll",
3
3
  "type": "module",
4
- "version": "0.10.1",
4
+ "version": "0.10.2",
5
5
  "description": "A high-performance virtual scroll component for Vue 3",
6
6
  "author": "",
7
7
  "license": "MIT",
@@ -426,6 +426,11 @@ export function useVirtualScroll<T = unknown>(
426
426
  programmaticScrollTimer = undefined;
427
427
  checkPendingScroll();
428
428
  }, 1000);
429
+ } else {
430
+ programmaticScrollTimer = setTimeout(() => {
431
+ isProgrammaticScroll.value = false;
432
+ programmaticScrollTimer = undefined;
433
+ }, 150);
429
434
  }
430
435
  }
431
436
  }
@@ -466,6 +471,11 @@ export function useVirtualScroll<T = unknown>(
466
471
  programmaticScrollTimer = undefined;
467
472
  checkPendingScroll();
468
473
  }, 1000);
474
+ } else {
475
+ programmaticScrollTimer = setTimeout(() => {
476
+ isProgrammaticScroll.value = false;
477
+ programmaticScrollTimer = undefined;
478
+ }, 150);
469
479
  }
470
480
  pendingScroll.value = null;
471
481
 
@@ -833,8 +843,8 @@ export function useVirtualScroll<T = unknown>(
833
843
  const { targetX, targetY } = calculateScrollTarget({ rowIndex, colIndex, options, direction: direction.value, viewportWidth: viewportWidth.value, viewportHeight: viewportHeight.value, totalWidth: virtualWidth.value, totalHeight: virtualHeight.value, gap: props.value.gap || 0, columnGap: props.value.columnGap || 0, fixedSize: fixedItemSize.value, fixedWidth: fixedColumnWidth.value, relativeScrollX: currentRelX, relativeScrollY: currentRelY, getItemSizeY: (idx) => itemSizesY.get(idx), getItemSizeX: (idx) => itemSizesX.get(idx), getItemQueryY: (idx) => itemSizesY.query(idx), getItemQueryX: (idx) => itemSizesX.query(idx), getColumnSize: (idx) => columnSizes.get(idx), getColumnQuery: (idx) => columnSizes.query(idx), scaleX: scaleX.value, scaleY: scaleY.value, hostOffsetX: componentOffset.x, hostOffsetY: componentOffset.y, stickyIndices: (props.value.stickyIndices || []), stickyStartX: stickyStartX.value, stickyStartY: stickyStartY.value, stickyEndX: stickyEndX.value, stickyEndY: stickyEndY.value, flowPaddingStartX: flowStartX.value, flowPaddingStartY: flowStartY.value, paddingStartX: paddingStartX.value, paddingStartY: paddingStartY.value, paddingEndX: paddingEndX.value, paddingEndY: paddingEndY.value });
834
844
  const toleranceX = 2 * scaleX.value;
835
845
  const toleranceY = 2 * scaleY.value;
836
- const reachedX = (colIndex === null || colIndex === undefined) || Math.abs(currentRelX - targetX) < toleranceX;
837
- const reachedY = (rowIndex === null || rowIndex === undefined) || Math.abs(currentRelY - targetY) < toleranceY;
846
+ const reachedX = (colIndex === null || colIndex === undefined) || (viewportWidth.value > 0 && Math.abs(currentRelX - targetX) < toleranceX);
847
+ const reachedY = (rowIndex === null || rowIndex === undefined) || (viewportHeight.value > 0 && Math.abs(currentRelY - targetY) < toleranceY);
838
848
  if (reachedX && reachedY) {
839
849
  const isMeasuredX = colIndex == null || colIndex === undefined || measuredColumns.value[ colIndex ] === 1;
840
850
  const isMeasuredY = rowIndex == null || rowIndex === undefined || measuredItemsY.value[ rowIndex ] === 1;