From e323abd10b088a2d2e462eb8136eb8e4093f903c Mon Sep 17 00:00:00 2001 From: Ashley Davis Date: Sat, 16 Nov 2024 10:55:34 +1000 Subject: [PATCH] Now clamping the scrollbar thumb to the maximum size. --- packages/user-interface/src/components/gallery-scrollbar.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/user-interface/src/components/gallery-scrollbar.tsx b/packages/user-interface/src/components/gallery-scrollbar.tsx index 7e7cae21..a95df22c 100644 --- a/packages/user-interface/src/components/gallery-scrollbar.tsx +++ b/packages/user-interface/src/components/gallery-scrollbar.tsx @@ -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(() => { @@ -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%",