Fix HideScrollbar
This commit is contained in:
@@ -139,6 +139,7 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>((prop
|
||||
const lastScrollbarClickPositionRef = useRef({ x: -1, y: -1 })
|
||||
const lastScrollbarTouchPositionRef = useRef({ x: -1, y: -1 })
|
||||
const lastTouchPositionRef = useRef({ x: -1, y: -1 })
|
||||
const [verticalScrollbarWidth, setVerticalScrollbarWidth] = useState(0)
|
||||
const [verticalScrollbarLength, setVerticalScrollbarLength] = useState(100)
|
||||
const [verticalScrollbarPosition, setVerticalScrollbarPosition] = useState(0)
|
||||
const [verticalScrollbarOnClick, setVerticalScrollbarOnClick] = useState(false)
|
||||
@@ -366,6 +367,9 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>((prop
|
||||
|
||||
useEffect(() => {
|
||||
const windowResizeListener = () => {
|
||||
setVerticalScrollbarWidth(
|
||||
(rootRef.current?.offsetWidth ?? 0) - (rootRef.current?.clientWidth ?? 0)
|
||||
)
|
||||
setHorizontalScrollbarWidth(
|
||||
(rootRef.current?.offsetHeight ?? 0) - (rootRef.current?.clientHeight ?? 0)
|
||||
)
|
||||
@@ -455,6 +459,7 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>((prop
|
||||
className={'hide-scrollbar-selection'}
|
||||
tabIndex={0}
|
||||
style={{
|
||||
width: `calc(100vw + ${verticalScrollbarWidth}px)`,
|
||||
height: `calc(100vh + ${horizontalScrollbarWidth}px)`,
|
||||
touchAction: isPreventAnyScroll ? 'none' : '',
|
||||
msTouchAction: isPreventAnyScroll ? 'none' : ''
|
||||
|
||||
Reference in New Issue
Block a user