{"version":3,"file":"Horizontal_scroll.oPybIRkt.mjs","names":["useRef","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/7PUJSi3nEnVa7NGM4kvO/zVccEXUw01dhqUhkVbLN/Horizontal_scroll.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";// Function to check if the device is desktop\nfunction isDesktop(){return typeof window!==\"undefined\"&&window.innerWidth>1024;}export function HorizontalScroll(){const containerRef=useRef(null);useEffect(()=>{const container=containerRef.current;if(container&&isDesktop()){const handleWheel=event=>{// Your custom horizontal scrolling logic here\nconst element=event.currentTarget;const delta=event.deltaY;// Determine if we're at the start or end of the scrollable section\nconst atStart=element.scrollLeft<=0;const atEnd=element.scrollLeft>=element.scrollWidth-element.clientWidth;//console.log(\"event\", event)\n//console.log(\"atStart\", atStart, \"atEnd\", atEnd, \"delta\", delta)\n// Allow vertical scrolling if the section is at the start or end\nif(atStart&&delta<0||atEnd&&delta>0){//console.log(\"allowing VERTICAL scrolling\")\n//isScrollingHorizontally = false\n//window.removeEventListener(\"wheel\", preventScroll)\nreturn;}else{event.preventDefault();//console.log(\"allowing HORIZONTAL scrolling\")\n//isScrollingHorizontally = true\n//window.addEventListener(\"wheel\", preventScroll, {\n//    passive: false,\n//})\n}// Scroll horizontally\nelement.scrollLeft+=delta;//isScrollingHorizontally = false\nconsole.log(\"Scrolled horizontally:\",event.deltaX,event.deltaY);};container.addEventListener(\"wheel\",handleWheel,{passive:false});// Cleanup function to remove the event listener\nreturn()=>{container.removeEventListener(\"wheel\",handleWheel);};}},[]);return{ref:containerRef};}/*\nimport { Override } from \"framer\"\n\n// Function to check if the device is desktop\nfunction isDesktop() {\n    return typeof window !== \"undefined\" && window.innerWidth > 1024\n}\n\nexport function HorizontalScroll(): Override {\n    let isScrollingHorizontally = false\n\n    return {\n        onWheel: (event) => {\n            // Only apply behavior on desktop devices\n            if (!isDesktop()) return\n\n            const element = event.currentTarget\n            const delta = event.deltaY\n\n            // Determine if we're at the start or end of the scrollable section\n            const atStart = element.scrollLeft <= 0\n            const atEnd =\n                element.scrollLeft >= element.scrollWidth - element.clientWidth\n            //console.log(\"event\", event)\n            console.log(\"atStart\", atStart, \"atEnd\", atEnd, \"delta\", delta)\n\n            // Allow vertical scrolling if the section is at the start or end\n            if ((atStart && delta < 0) || (atEnd && delta > 0)) {\n                console.log(\"allowing VERTICAL scrolling\")\n                isScrollingHorizontally = false\n                \n                //window.removeEventListener(\"wheel\", preventScroll)\n                return\n            } else {\n                console.log(\"allowing HORIZONTAL scrolling\")\n                isScrollingHorizontally = true\n                \n                //window.addEventListener(\"wheel\", preventScroll, {\n                //    passive: false,\n                //})\n            }\n\n            // Scroll horizontally\n            element.scrollLeft += delta\n            isScrollingHorizontally = false\n\n            // Prevent vertical scrolling of the page\n            event.preventDefault()\n        },\n        onMouseEnter: () => {\n            // Enable horizontal scrolling behavior when mouse enters the section\n            if (isDesktop()) {\n                window.addEventListener(\"wheel\", preventScroll, {\n                    passive: false,\n                })\n            }\n        },\n        onMouseLeave: () => {\n            // Disable horizontal scrolling behavior when mouse leaves the section\n            \n            //isScrollingHorizontally = false\n            //window.removeEventListener(\"wheel\", preventScroll)\n        },\n    }\n}\n\n// Function to prevent default page scrolling\nfunction preventScroll(event: WheelEvent) {\n    event.preventDefault()\n}\n*/import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withHorizontalScroll(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...HorizontalScroll(props)});};}withHorizontalScroll.displayName=\"HorizontalScroll\";\nexport const __FramerMetadata__ = {\"exports\":{\"HorizontalScroll\":{\"type\":\"override\",\"name\":\"HorizontalScroll\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHorizontalScroll\":{\"type\":\"reactHoc\",\"name\":\"withHorizontalScroll\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Horizontal_scroll.map"],"mappings":"gMACA,SAAS,GAAW,CAAC,OAAc,IAAS,QAAa,EAAO,WAAW,IAAK,CAAC,SAAgB,GAAkB,CAAC,IAAM,EAAaA,EAAO,IAAI,EAgB3E,OAhB6E,MAAc,CAAC,IAAM,EAAU,EAAa,QAAQ,GAAG,GAAW,EAAU,EAAE,CAAC,IAAM,EAAY,GAAO,CAC5P,IAAM,EAAQ,EAAM,cAAoB,EAAM,EAAM,OAC9C,EAAQ,EAAQ,YAAY,EAAQ,EAAM,EAAQ,YAAY,EAAQ,YAAY,EAAQ,YAG7F,GAAS,EAAM,GAAG,GAAO,EAAM,IAGrB,EAAM,eAAe,EAMlC,EAAQ,YAAY,EACpB,QAAQ,IAAI,yBAAyB,EAAM,OAAO,EAAM,MAAM,EAAE,EAChE,OADkE,EAAU,iBAAiB,QAAQ,EAAY,CAAC,QAAQ,EAAK,CAAC,MACtH,CAAC,EAAU,oBAAoB,QAAQ,CAAW,CAAE,CAAE,CAAC,EAAE,CAAC,CAAC,EAAQ,CAAC,IAAI,CAAY,CAAE,CAsEqD,SAAgB,EAAqB,EAAE,CAAC,MAAO,KAAQ,EAA+BC,CAAuC,EAASC,EAAK,EAAE,CAAC,GAAG,EAAM,GAAG,EAAiB,CAAK,CAAC,CAAC,EAAI,qBAvFjS,IAAoC,IAuFsE,EAAwL,EAAqB,YAAY"}