Skip to content

Commit

Permalink
format utils
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostebony committed Aug 13, 2023
1 parent ab1d91c commit de01b37
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ export function scrollSpeed(refresh = 200) {
let isScrollingFast: ReturnType<typeof setTimeout> | undefined;

return (
size: number,
speed: number,
callback: {
fast: () => void;
slow: () => void;
}
},
) =>
(scrollPosition: number) => {
if (!lastScrollPosition) {
lastScrollPosition = scrollPosition;
} else {
if (Math.abs(scrollPosition - lastScrollPosition) > size) {
if (Math.abs(scrollPosition - lastScrollPosition) > speed) {
callback.fast();

if (isScrollingFast !== undefined) {
Expand Down Expand Up @@ -59,7 +59,7 @@ export const getGridIndices = (
height: number,
columnCount: number,
overScanColumn: number,
scrollPosition: number
scrollPosition: number,
) => {
const indices: number[] = [];

Expand All @@ -71,7 +71,7 @@ export const getGridIndices = (

const endIndexTemp = Math.min(
itemCount,
round.ceil(((scrollPosition + height) / itemHeight) * columnCount, columnCount)
round.ceil(((scrollPosition + height) / itemHeight) * columnCount, columnCount),
);
const endIndexOverScan = endIndexTemp + overScanColumn;
const endIndex = endIndexOverScan < itemCount ? endIndexOverScan : itemCount;
Expand All @@ -86,7 +86,7 @@ export const getListIndices = (
itemSize: number,
size: number,
overScan: number,
scrollPosition: number
scrollPosition: number,
) => {
const indices: number[] = [];

Expand Down

0 comments on commit de01b37

Please sign in to comment.