mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-05-23 16:54:09 +03:00
improve code for body
This commit is contained in:
@@ -109,7 +109,7 @@ export const defaultOptions: Options = {
|
||||
theme: 'os-theme-dark',
|
||||
visibility: 'auto', // visible || hidden || auto || v || h || a
|
||||
autoHide: 'never', // never || scroll || leave || move || n || s || l || m
|
||||
autoHideDelay: 800, // number
|
||||
autoHideDelay: 1300, // number
|
||||
dragScroll: true, // true || false
|
||||
clickScroll: false, // true || false
|
||||
pointers: ['mouse', 'touch', 'pen'], // null || array of supported pointers: https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType
|
||||
|
||||
@@ -196,8 +196,9 @@ export const createScrollbarsSetup = (
|
||||
const [dragScroll, dragScrollChanged] = checkOption<boolean>('scrollbars.dragScroll');
|
||||
const [clickScroll, clickScrollChanged] = checkOption<boolean>('scrollbars.clickScroll');
|
||||
|
||||
const updateHandle = _overflowEdgeChanged || _overflowAmountChanged || _directionChanged;
|
||||
const updateVisibility = _overflowStyleChanged || visibilityChanged;
|
||||
const updateHandle =
|
||||
_overflowEdgeChanged || _overflowAmountChanged || _directionChanged || force;
|
||||
const updateVisibility = _overflowStyleChanged || visibilityChanged || force;
|
||||
|
||||
const setScrollbarVisibility = (overflowStyle: OverflowStyle, isHorizontal: boolean) => {
|
||||
const isVisible =
|
||||
|
||||
@@ -325,7 +325,7 @@ export const createStructureSetupObservers = (
|
||||
_ignoreContentChange: (mutation, isNestedTarget) => {
|
||||
const { target, attributeName } = mutation;
|
||||
const ignore =
|
||||
!isNestedTarget && attributeName
|
||||
!isNestedTarget && attributeName && !_viewportIsTarget
|
||||
? liesBetween(target, hostSelector, viewportSelector)
|
||||
: false;
|
||||
return (
|
||||
|
||||
+13
-6
@@ -105,6 +105,8 @@ export const createOverflowUpdateSegment: CreateStructureUpdateSegment = (
|
||||
_viewportArrange,
|
||||
_viewportIsTarget,
|
||||
_viewportAddRemoveClass,
|
||||
_isBody,
|
||||
_windowElm,
|
||||
} = structureSetupElements;
|
||||
const {
|
||||
_nativeScrollbarsSize,
|
||||
@@ -119,6 +121,7 @@ export const createOverflowUpdateSegment: CreateStructureUpdateSegment = (
|
||||
!_viewportIsTarget &&
|
||||
!_nativeScrollbarsHiding &&
|
||||
(_nativeScrollbarsOverlaid.x || _nativeScrollbarsOverlaid.y);
|
||||
const viewportIsTargetBody = _isBody && _viewportIsTarget;
|
||||
|
||||
const [updateSizeFraction, getCurrentSizeFraction] = createCache<WH<number>>(
|
||||
whCacheOptions,
|
||||
@@ -414,14 +417,18 @@ export const createOverflowUpdateSegment: CreateStructureUpdateSegment = (
|
||||
};
|
||||
const overflowAmountClientSize = {
|
||||
w: max0(
|
||||
arrangedViewportClientSize.w +
|
||||
max0(viewportclientSize.w - viewportScrollSize.w) +
|
||||
sizeFraction.w
|
||||
viewportIsTargetBody
|
||||
? _windowElm.innerWidth
|
||||
: arrangedViewportClientSize.w +
|
||||
max0(viewportclientSize.w - viewportScrollSize.w) +
|
||||
sizeFraction.w
|
||||
),
|
||||
h: max0(
|
||||
arrangedViewportClientSize.h +
|
||||
max0(viewportclientSize.h - viewportScrollSize.h) +
|
||||
sizeFraction.h
|
||||
viewportIsTargetBody
|
||||
? _windowElm.innerHeight
|
||||
: arrangedViewportClientSize.h +
|
||||
max0(viewportclientSize.h - viewportScrollSize.h) +
|
||||
sizeFraction.h
|
||||
),
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user