rc-virtual-list
Advanced tools
Comparing version 3.10.5 to 3.10.6
@@ -17,5 +17,4 @@ import { useRef } from 'react'; | ||
var originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom); | ||
function onWheelY(event) { | ||
function onWheelY(event, deltaY) { | ||
raf.cancel(nextFrameRef.current); | ||
var deltaY = event.deltaY; | ||
offsetRef.current += deltaY; | ||
@@ -37,4 +36,3 @@ wheelValueRef.current = deltaY; | ||
} | ||
function onWheelX(event) { | ||
var deltaX = event.deltaX; | ||
function onWheelX(event, deltaX) { | ||
onWheelDelta(deltaX, true); | ||
@@ -45,3 +43,3 @@ if (!isFF) { | ||
} | ||
// Check for which direction does wheel do | ||
// Check for which direction does wheel do. `sx` means `shift + wheel` | ||
var wheelDirectionRef = useRef(null); | ||
@@ -57,12 +55,20 @@ var wheelDirectionCleanRef = useRef(null); | ||
var deltaX = event.deltaX, | ||
deltaY = event.deltaY; | ||
var absX = Math.abs(deltaX); | ||
var absY = Math.abs(deltaY); | ||
deltaY = event.deltaY, | ||
shiftKey = event.shiftKey; | ||
var mergedDeltaX = deltaX; | ||
var mergedDeltaY = deltaY; | ||
if (wheelDirectionRef.current === 'sx' || !wheelDirectionRef.current && (shiftKey || false) && deltaY && !deltaX) { | ||
mergedDeltaX = deltaY; | ||
mergedDeltaY = 0; | ||
wheelDirectionRef.current = 'sx'; | ||
} | ||
var absX = Math.abs(mergedDeltaX); | ||
var absY = Math.abs(mergedDeltaY); | ||
if (wheelDirectionRef.current === null) { | ||
wheelDirectionRef.current = horizontalScroll && absX > absY ? 'x' : 'y'; | ||
} | ||
if (wheelDirectionRef.current === 'x') { | ||
onWheelX(event); | ||
if (wheelDirectionRef.current === 'y') { | ||
onWheelY(event, mergedDeltaY); | ||
} else { | ||
onWheelY(event); | ||
onWheelX(event, mergedDeltaX); | ||
} | ||
@@ -69,0 +75,0 @@ } |
@@ -24,5 +24,4 @@ "use strict"; | ||
var originScroll = (0, _useOriginScroll.default)(isScrollAtTop, isScrollAtBottom); | ||
function onWheelY(event) { | ||
function onWheelY(event, deltaY) { | ||
_raf.default.cancel(nextFrameRef.current); | ||
var deltaY = event.deltaY; | ||
offsetRef.current += deltaY; | ||
@@ -44,4 +43,3 @@ wheelValueRef.current = deltaY; | ||
} | ||
function onWheelX(event) { | ||
var deltaX = event.deltaX; | ||
function onWheelX(event, deltaX) { | ||
onWheelDelta(deltaX, true); | ||
@@ -52,3 +50,3 @@ if (!_isFirefox.default) { | ||
} | ||
// Check for which direction does wheel do | ||
// Check for which direction does wheel do. `sx` means `shift + wheel` | ||
var wheelDirectionRef = (0, _react.useRef)(null); | ||
@@ -64,12 +62,20 @@ var wheelDirectionCleanRef = (0, _react.useRef)(null); | ||
var deltaX = event.deltaX, | ||
deltaY = event.deltaY; | ||
var absX = Math.abs(deltaX); | ||
var absY = Math.abs(deltaY); | ||
deltaY = event.deltaY, | ||
shiftKey = event.shiftKey; | ||
var mergedDeltaX = deltaX; | ||
var mergedDeltaY = deltaY; | ||
if (wheelDirectionRef.current === 'sx' || !wheelDirectionRef.current && (shiftKey || false) && deltaY && !deltaX) { | ||
mergedDeltaX = deltaY; | ||
mergedDeltaY = 0; | ||
wheelDirectionRef.current = 'sx'; | ||
} | ||
var absX = Math.abs(mergedDeltaX); | ||
var absY = Math.abs(mergedDeltaY); | ||
if (wheelDirectionRef.current === null) { | ||
wheelDirectionRef.current = horizontalScroll && absX > absY ? 'x' : 'y'; | ||
} | ||
if (wheelDirectionRef.current === 'x') { | ||
onWheelX(event); | ||
if (wheelDirectionRef.current === 'y') { | ||
onWheelY(event, mergedDeltaY); | ||
} else { | ||
onWheelY(event); | ||
onWheelX(event, mergedDeltaX); | ||
} | ||
@@ -76,0 +82,0 @@ } |
{ | ||
"name": "rc-virtual-list", | ||
"version": "3.10.5", | ||
"version": "3.10.6", | ||
"description": "React Virtual List Component", | ||
@@ -5,0 +5,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
120557
3048