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

1 line
5.3 KiB
JSON

{"ast":null,"code":"import { useRef } from 'react';\nexport default (function (isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight) {\n // Do lock for a wheel when scrolling\n var lockRef = useRef(false);\n var lockTimeoutRef = useRef(null);\n function lockScroll() {\n clearTimeout(lockTimeoutRef.current);\n lockRef.current = true;\n lockTimeoutRef.current = setTimeout(function () {\n lockRef.current = false;\n }, 50);\n }\n\n // Pass to ref since global add is in closure\n var scrollPingRef = useRef({\n top: isScrollAtTop,\n bottom: isScrollAtBottom,\n left: isScrollAtLeft,\n right: isScrollAtRight\n });\n scrollPingRef.current.top = isScrollAtTop;\n scrollPingRef.current.bottom = isScrollAtBottom;\n scrollPingRef.current.left = isScrollAtLeft;\n scrollPingRef.current.right = isScrollAtRight;\n return function (isHorizontal, delta) {\n var smoothOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var originScroll = isHorizontal ?\n // Pass origin wheel when on the left\n delta < 0 && scrollPingRef.current.left ||\n // Pass origin wheel when on the right\n delta > 0 && scrollPingRef.current.right // Pass origin wheel when on the top\n : delta < 0 && scrollPingRef.current.top ||\n // Pass origin wheel when on the bottom\n delta > 0 && scrollPingRef.current.bottom;\n if (smoothOffset && originScroll) {\n // No need lock anymore when it's smooth offset from touchMove interval\n clearTimeout(lockTimeoutRef.current);\n lockRef.current = false;\n } else if (!originScroll || lockRef.current) {\n lockScroll();\n }\n return !lockRef.current && originScroll;\n };\n});","map":{"version":3,"names":["useRef","isScrollAtTop","isScrollAtBottom","isScrollAtLeft","isScrollAtRight","lockRef","lockTimeoutRef","lockScroll","clearTimeout","current","setTimeout","scrollPingRef","top","bottom","left","right","isHorizontal","delta","smoothOffset","arguments","length","undefined","originScroll"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-virtual-list/es/hooks/useOriginScroll.js"],"sourcesContent":["import { useRef } from 'react';\nexport default (function (isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight) {\n // Do lock for a wheel when scrolling\n var lockRef = useRef(false);\n var lockTimeoutRef = useRef(null);\n function lockScroll() {\n clearTimeout(lockTimeoutRef.current);\n lockRef.current = true;\n lockTimeoutRef.current = setTimeout(function () {\n lockRef.current = false;\n }, 50);\n }\n\n // Pass to ref since global add is in closure\n var scrollPingRef = useRef({\n top: isScrollAtTop,\n bottom: isScrollAtBottom,\n left: isScrollAtLeft,\n right: isScrollAtRight\n });\n scrollPingRef.current.top = isScrollAtTop;\n scrollPingRef.current.bottom = isScrollAtBottom;\n scrollPingRef.current.left = isScrollAtLeft;\n scrollPingRef.current.right = isScrollAtRight;\n return function (isHorizontal, delta) {\n var smoothOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var originScroll = isHorizontal ?\n // Pass origin wheel when on the left\n delta < 0 && scrollPingRef.current.left ||\n // Pass origin wheel when on the right\n delta > 0 && scrollPingRef.current.right // Pass origin wheel when on the top\n : delta < 0 && scrollPingRef.current.top ||\n // Pass origin wheel when on the bottom\n delta > 0 && scrollPingRef.current.bottom;\n if (smoothOffset && originScroll) {\n // No need lock anymore when it's smooth offset from touchMove interval\n clearTimeout(lockTimeoutRef.current);\n lockRef.current = false;\n } else if (!originScroll || lockRef.current) {\n lockScroll();\n }\n return !lockRef.current && originScroll;\n };\n});"],"mappings":"AAAA,SAASA,MAAM,QAAQ,OAAO;AAC9B,gBAAgB,UAAUC,aAAa,EAAEC,gBAAgB,EAAEC,cAAc,EAAEC,eAAe,EAAE;EAC1F;EACA,IAAIC,OAAO,GAAGL,MAAM,CAAC,KAAK,CAAC;EAC3B,IAAIM,cAAc,GAAGN,MAAM,CAAC,IAAI,CAAC;EACjC,SAASO,UAAUA,CAAA,EAAG;IACpBC,YAAY,CAACF,cAAc,CAACG,OAAO,CAAC;IACpCJ,OAAO,CAACI,OAAO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