Optimize HideScrollbar
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
@use '@/assets/css/constants' as constants;
|
@use '@/assets/css/constants' as constants;
|
||||||
|
|
||||||
.hide-scrollbar-mask {
|
.hide-scrollbar-mask {
|
||||||
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -49,8 +50,9 @@
|
|||||||
padding: 12px 4px;
|
padding: 12px 4px;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
right: 0;
|
left: 100%;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
transform: translateX(-100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.horizontal-scrollbar {
|
.horizontal-scrollbar {
|
||||||
@@ -58,6 +60,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
top: 100%;
|
||||||
|
transform: translateY(-100%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -459,8 +459,8 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>((prop
|
|||||||
className={'hide-scrollbar-selection'}
|
className={'hide-scrollbar-selection'}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
style={{
|
style={{
|
||||||
width: `calc(100vw + ${verticalScrollbarWidth}px)`,
|
width: `calc(${maskRef.current?.clientWidth}px + ${verticalScrollbarWidth}px)`,
|
||||||
height: `calc(100vh + ${horizontalScrollbarWidth}px)`,
|
height: `calc(${maskRef.current?.clientHeight}px + ${horizontalScrollbarWidth}px)`,
|
||||||
touchAction: isPreventAnyScroll ? 'none' : '',
|
touchAction: isPreventAnyScroll ? 'none' : '',
|
||||||
msTouchAction: isPreventAnyScroll ? 'none' : ''
|
msTouchAction: isPreventAnyScroll ? 'none' : ''
|
||||||
}}
|
}}
|
||||||
@@ -482,6 +482,13 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>((prop
|
|||||||
verticalScrollbarLength === 100)
|
verticalScrollbarLength === 100)
|
||||||
}
|
}
|
||||||
className={'scrollbar vertical-scrollbar'}
|
className={'scrollbar vertical-scrollbar'}
|
||||||
|
style={{
|
||||||
|
height: maskRef.current ? maskRef.current?.clientHeight - 1 : undefined,
|
||||||
|
top: maskRef.current?.clientTop,
|
||||||
|
left: maskRef.current
|
||||||
|
? maskRef.current?.clientLeft + maskRef.current?.clientWidth - 1
|
||||||
|
: undefined
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div className={'box'}>
|
<div className={'box'}>
|
||||||
<div
|
<div
|
||||||
@@ -512,6 +519,13 @@ const HideScrollbar = forwardRef<HideScrollbarElement, HideScrollbarProps>((prop
|
|||||||
horizontalScrollbarLength === 100)
|
horizontalScrollbarLength === 100)
|
||||||
}
|
}
|
||||||
className={'scrollbar horizontal-scrollbar'}
|
className={'scrollbar horizontal-scrollbar'}
|
||||||
|
style={{
|
||||||
|
width: maskRef.current ? maskRef.current?.clientWidth - 1 : undefined,
|
||||||
|
left: maskRef.current?.clientLeft,
|
||||||
|
top: maskRef.current
|
||||||
|
? maskRef.current?.clientTop + maskRef.current?.clientHeight - 1
|
||||||
|
: undefined
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div className={'box'}>
|
<div className={'box'}>
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user