mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-12 16:54:55 -05:00
refactor: gallery scroll (improved impl)
This commit is contained in:
@@ -41,6 +41,8 @@ type ImageCollectionQueryArgs = {
|
||||
|
||||
// Constants
|
||||
const RANGE_SIZE = 50;
|
||||
const VIEWPORT_BUFFER = 2048;
|
||||
const SCROLL_SEEK_VELOCITY_THRESHOLD = 2048;
|
||||
|
||||
type GridContext = {
|
||||
queryArgs: ImageCollectionQueryArgs;
|
||||
@@ -283,7 +285,7 @@ export const NewGallery = memo(() => {
|
||||
context={context}
|
||||
totalCount={imageNames.length}
|
||||
data={imageNames}
|
||||
increaseViewportBy={2048}
|
||||
increaseViewportBy={VIEWPORT_BUFFER}
|
||||
itemContent={itemContent}
|
||||
computeItemKey={computeItemKey}
|
||||
components={components}
|
||||
@@ -299,7 +301,7 @@ export const NewGallery = memo(() => {
|
||||
NewGallery.displayName = 'NewGallery';
|
||||
|
||||
const scrollSeekConfiguration: ScrollSeekConfiguration = {
|
||||
enter: (velocity) => velocity > 2048,
|
||||
enter: (velocity) => velocity > SCROLL_SEEK_VELOCITY_THRESHOLD,
|
||||
exit: (velocity) => velocity === 0,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user