Skip to content

Commit

Permalink
Now clamping the scrollbar thumb to the maximum size.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleydavis committed Nov 16, 2024
1 parent 40ef6eb commit e323abd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/user-interface/src/components/gallery-scrollbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function GalleryScrollbar({ galleryContainerHeight, galleryLayout, scroll
}

useEffect(() => {
setThumbHeight(Math.max(MIN_SCROLLTHUMB_HEIGHT, (galleryContainerHeight / galleryLayout?.galleryHeight) * scrollbarHeight));
setThumbHeight(Math.min(Math.max(MIN_SCROLLTHUMB_HEIGHT, (galleryContainerHeight / galleryLayout?.galleryHeight) * scrollbarHeight), scrollbarHeight - VERTICAL_GUTTER - VERTICAL_GUTTER));
}, [galleryContainerHeight, galleryLayout?.galleryHeight, scrollbarHeight]);

useEffect(() => {
Expand Down Expand Up @@ -397,7 +397,7 @@ export function GalleryScrollbar({ galleryContainerHeight, galleryLayout, scroll
onMouseDown={onMouseDown}
onTouchStart={onTouchStart}
style={{
position: "absolute",
position: "fixed",
top: `${thumbPos}px`,
height: `${thumbHeight}px`,
width: "100%",
Expand Down

0 comments on commit e323abd

Please sign in to comment.