PromoCursed/node_modules/.cache/babel-loader/5ee550e1de7c7178c8e0c7bd9342fa7666b0ca431a551f3cdc3b27d7fd21e2e6.json
2024-08-20 23:25:37 +04:00

1 line
8.9 KiB
JSON

{"ast":null,"code":"import raf from \"rc-util/es/raf\";\nimport { useRef } from 'react';\nimport isFF from \"../utils/isFirefox\";\nimport useOriginScroll from \"./useOriginScroll\";\nexport default function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight, horizontalScroll,\n/***\n * Return `true` when you need to prevent default event\n */\nonWheelDelta) {\n var offsetRef = useRef(0);\n var nextFrameRef = useRef(null);\n\n // Firefox patch\n var wheelValueRef = useRef(null);\n var isMouseScrollRef = useRef(false);\n\n // Scroll status sync\n var originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight);\n function onWheelY(event, deltaY) {\n raf.cancel(nextFrameRef.current);\n offsetRef.current += deltaY;\n wheelValueRef.current = deltaY;\n\n // Do nothing when scroll at the edge, Skip check when is in scroll\n if (originScroll(false, deltaY)) return;\n\n // Proxy of scroll events\n if (!isFF) {\n event.preventDefault();\n }\n nextFrameRef.current = raf(function () {\n // Patch a multiple for Firefox to fix wheel number too small\n // ref: https://github.com/ant-design/ant-design/issues/26372#issuecomment-679460266\n var patchMultiple = isMouseScrollRef.current ? 10 : 1;\n onWheelDelta(offsetRef.current * patchMultiple);\n offsetRef.current = 0;\n });\n }\n function onWheelX(event, deltaX) {\n onWheelDelta(deltaX, true);\n if (!isFF) {\n event.preventDefault();\n }\n }\n\n // Check for which direction does wheel do. `sx` means `shift + wheel`\n var wheelDirectionRef = useRef(null);\n var wheelDirectionCleanRef = useRef(null);\n function onWheel(event) {\n if (!inVirtual) return;\n\n // Wait for 2 frame to clean direction\n raf.cancel(wheelDirectionCleanRef.current);\n wheelDirectionCleanRef.current = raf(function () {\n wheelDirectionRef.current = null;\n }, 2);\n var deltaX = event.deltaX,\n deltaY = event.deltaY,\n shiftKey = event.shiftKey;\n var mergedDeltaX = deltaX;\n var mergedDeltaY = deltaY;\n if (wheelDirectionRef.current === 'sx' || !wheelDirectionRef.current && (shiftKey || false) && deltaY && !deltaX) {\n mergedDeltaX = deltaY;\n mergedDeltaY = 0;\n wheelDirectionRef.current = 'sx';\n }\n var absX = Math.abs(mergedDeltaX);\n var absY = Math.abs(mergedDeltaY);\n if (wheelDirectionRef.current === null) {\n wheelDirectionRef.current = horizontalScroll && absX > absY ? 'x' : 'y';\n }\n if (wheelDirectionRef.current === 'y') {\n onWheelY(event, mergedDeltaY);\n } else {\n onWheelX(event, mergedDeltaX);\n }\n }\n\n // A patch for firefox\n function onFireFoxScroll(event) {\n if (!inVirtual) return;\n isMouseScrollRef.current = event.detail === wheelValueRef.current;\n }\n return [onWheel, onFireFoxScroll];\n}","map":{"version":3,"names":["raf","useRef","isFF","useOriginScroll","useFrameWheel","inVirtual","isScrollAtTop","isScrollAtBottom","isScrollAtLeft","isScrollAtRight","horizontalScroll","onWheelDelta","offsetRef","nextFrameRef","wheelValueRef","isMouseScrollRef","originScroll","onWheelY","event","deltaY","cancel","current","preventDefault","patchMultiple","onWheelX","deltaX","wheelDirectionRef","wheelDirectionCleanRef","onWheel","shiftKey","mergedDeltaX","mergedDeltaY","absX","Math","abs","absY","onFireFoxScroll","detail"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-virtual-list/es/hooks/useFrameWheel.js"],"sourcesContent":["import raf from \"rc-util/es/raf\";\nimport { useRef } from 'react';\nimport isFF from \"../utils/isFirefox\";\nimport useOriginScroll from \"./useOriginScroll\";\nexport default function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight, horizontalScroll,\n/***\n * Return `true` when you need to prevent default event\n */\nonWheelDelta) {\n var offsetRef = useRef(0);\n var nextFrameRef = useRef(null);\n\n // Firefox patch\n var wheelValueRef = useRef(null);\n var isMouseScrollRef = useRef(false);\n\n // Scroll status sync\n var originScroll = useOriginScroll(isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight);\n function onWheelY(event, deltaY) {\n raf.cancel(nextFrameRef.current);\n offsetRef.current += deltaY;\n wheelValueRef.current = deltaY;\n\n // Do nothing when scroll at the edge, Skip check when is in scroll\n if (originScroll(false, deltaY)) return;\n\n // Proxy of scroll events\n if (!isFF) {\n event.preventDefault();\n }\n nextFrameRef.current = raf(function () {\n // Patch a multiple for Firefox to fix wheel number too small\n // ref: https://github.com/ant-design/ant-design/issues/26372#issuecomment-679460266\n var patchMultiple = isMouseScrollRef.current ? 10 : 1;\n onWheelDelta(offsetRef.current * patchMultiple);\n offsetRef.current = 0;\n });\n }\n function onWheelX(event, deltaX) {\n onWheelDelta(deltaX, true);\n if (!isFF) {\n event.preventDefault();\n }\n }\n\n // Check for which direction does wheel do. `sx` means `shift + wheel`\n var wheelDirectionRef = useRef(null);\n var wheelDirectionCleanRef = useRef(null);\n function onWheel(event) {\n if (!inVirtual) return;\n\n // Wait for 2 frame to clean direction\n raf.cancel(wheelDirectionCleanRef.current);\n wheelDirectionCleanRef.current = raf(function () {\n wheelDirectionRef.current = null;\n }, 2);\n var deltaX = event.deltaX,\n deltaY = event.deltaY,\n shiftKey = event.shiftKey;\n var mergedDeltaX = deltaX;\n var mergedDeltaY = deltaY;\n if (wheelDirectionRef.current === 'sx' || !wheelDirectionRef.current && (shiftKey || false) && deltaY && !deltaX) {\n mergedDeltaX = deltaY;\n mergedDeltaY = 0;\n wheelDirectionRef.current = 'sx';\n }\n var absX = Math.abs(mergedDeltaX);\n var absY = Math.abs(mergedDeltaY);\n if (wheelDirectionRef.current === null) {\n wheelDirectionRef.current = horizontalScroll && absX > absY ? 'x' : 'y';\n }\n if (wheelDirectionRef.current === 'y') {\n onWheelY(event, mergedDeltaY);\n } else {\n onWheelX(event, mergedDeltaX);\n }\n }\n\n // A patch for firefox\n function onFireFoxScroll(event) {\n if (!inVirtual) return;\n isMouseScrollRef.current = event.detail === wheelValueRef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