Skip to content

Commit

Permalink
Fix thumb size when ignoring some top scroll (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
diksipav authored Mar 22, 2024
1 parent 228f613 commit 1a4ef05
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions shared/common/ui/customScrollbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,23 @@ export function CustomScrollbars({
const hasV = el.scrollHeight > el.clientHeight;
const hasH = el.scrollWidth > el.clientWidth;

if (scrollBarHeight === 0 && el.clientHeight < el.scrollHeight) {
if (hasV) {
setScrollBarHeight(
el.clientHeight - (hasH ? 8 : verScrollBarBottomOffset) - headerPadding
el.clientHeight -
(hasH ? 8 : verScrollBarBottomOffset) -
headerPadding +
scrollBarTopOffset
);
}

thumbSizes.current = [
hasV
? Math.max(
28,
((el.clientHeight + verScrollIgnoreLength) * scrollBarHeight) /
el.scrollHeight
el.clientHeight < el.scrollHeight - verScrollIgnoreLength
? ((el.clientHeight + verScrollIgnoreLength) * scrollBarHeight) /
el.scrollHeight
: scrollBarHeight
)
: -1,
hasH
Expand Down

0 comments on commit 1a4ef05

Please sign in to comment.