@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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/composables/useVirtualScroll.ts +12 -2
package/package.json
CHANGED
|
@@ -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;
|