Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
inokawa committed Jan 6, 2024
1 parent af730db commit 1e7d7e1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/core/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type ItemsRange = Readonly<[startIndex: number, endIndex: number]>;
/**
* @internal
*/
export const clampStartIndex = (
export const overscanStartIndex = (
startIndex: number,
overscan: number,
scrollDirection: ScrollDirection
Expand All @@ -96,7 +96,7 @@ export const clampStartIndex = (
/**
* @internal
*/
export const clampEndIndex = (
export const overscanEndIndex = (
endIndex: number,
overscan: number,
scrollDirection: ScrollDirection,
Expand Down
12 changes: 6 additions & 6 deletions src/react/VGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
ACTION_ITEMS_LENGTH_CHANGE,
UPDATE_SCROLL_STATE,
UPDATE_SIZE_STATE,
clampEndIndex,
clampStartIndex,
overscanEndIndex,
overscanStartIndex,
createVirtualStore,
SCROLL_IDLE,
} from "../core/store";
Expand Down Expand Up @@ -359,23 +359,23 @@ export const VGrid = forwardRef<VGridHandle, VGridProps>(
};
}, [children]);

const overscanedStartRowIndex = clampStartIndex(
const overscanedStartRowIndex = overscanStartIndex(
startRowIndex,
overscan,
vScrollDirection
);
const overscanedEndRowIndex = clampEndIndex(
const overscanedEndRowIndex = overscanEndIndex(
endRowIndex,
overscan,
vScrollDirection,
rowCount
);
const overscanedStartColIndex = clampStartIndex(
const overscanedStartColIndex = overscanStartIndex(
startColIndex,
overscan,
hScrollDirection
);
const overscanedEndColIndex = clampEndIndex(
const overscanedEndColIndex = overscanEndIndex(
endColIndex,
overscan,
hScrollDirection,
Expand Down
8 changes: 4 additions & 4 deletions src/react/VList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
import {
UPDATE_SCROLL_EVENT,
ACTION_ITEMS_LENGTH_CHANGE,
clampEndIndex,
clampStartIndex,
overscanEndIndex,
overscanStartIndex,
createVirtualStore,
UPDATE_SIZE_STATE,
UPDATE_SCROLL_STATE,
Expand Down Expand Up @@ -305,12 +305,12 @@ export const VList = forwardRef<VListHandle, VListProps>(
[]

Check warning on line 305 in src/react/VList.tsx

View workflow job for this annotation

GitHub Actions / check

React Hook useImperativeHandle has missing dependencies: 'scroller._scrollBy', 'scroller._scrollTo', 'scroller._scrollToIndex', and 'store'. Either include them or remove the dependency array
);

const overscanedStartIndex = clampStartIndex(
const overscanedStartIndex = overscanStartIndex(
startIndex,
overscan,
scrollDirection
);
const overscanedEndIndex = clampEndIndex(
const overscanedEndIndex = overscanEndIndex(
endIndex,
overscan,
scrollDirection,
Expand Down
8 changes: 4 additions & 4 deletions src/react/WVList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
ACTION_ITEMS_LENGTH_CHANGE,
UPDATE_SCROLL_STATE,
UPDATE_SIZE_STATE,
clampEndIndex,
clampStartIndex,
overscanEndIndex,
overscanStartIndex,
createVirtualStore,
SCROLL_IDLE,
UPDATE_SCROLL_STOP_EVENT,
Expand Down Expand Up @@ -250,12 +250,12 @@ export const WVList = forwardRef<WVListHandle, WVListProps>(
[]

Check warning on line 250 in src/react/WVList.tsx

View workflow job for this annotation

GitHub Actions / check

React Hook useImperativeHandle has a missing dependency: 'store'. Either include it or remove the dependency array
);

const overscanedStartIndex = clampStartIndex(
const overscanedStartIndex = overscanStartIndex(
startIndex,
overscan,
scrollDirection
);
const overscanedEndIndex = clampEndIndex(
const overscanedEndIndex = overscanEndIndex(
endIndex,
overscan,
scrollDirection,
Expand Down
8 changes: 4 additions & 4 deletions src/vue/VList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
UPDATE_SCROLL_EVENT,
UPDATE_SCROLL_STOP_EVENT,
UPDATE_SIZE_STATE,
clampEndIndex,
clampStartIndex,
overscanEndIndex,
overscanStartIndex,
createVirtualStore,
ACTION_ITEMS_LENGTH_CHANGE,
} from "../core/store";
Expand Down Expand Up @@ -190,12 +190,12 @@ export const VList = /*#__PURE__*/ defineComponent({
const scrollDirection = store._getScrollDirection();
const scrollSize = store._getScrollSize();

const overscanedStartIndex = clampStartIndex(
const overscanedStartIndex = overscanStartIndex(
startIndex,
props.overscan,
scrollDirection
);
const overscanedEndIndex = clampEndIndex(
const overscanedEndIndex = overscanEndIndex(
endIndex,
props.overscan,
scrollDirection,
Expand Down

0 comments on commit 1e7d7e1

Please sign in to comment.