Build 545032stable
Module 600761
1,439 characters · in 19d8bf26cd2f0320.js, 9b93149ea2bd68d2.jsDependencies
Source Raw
function(e,t,n){n.d(t,{i:()=>a});var i=n(64700),l=n(688807),s=n(425763);function a(e){let{containerRef:t,itemType:n="WIDGET",edgeDistance:a=130,maxSpeed:r=1700,power:c=2.2}=e,o=(0,i.useRef)(null),u=(0,i.useRef)(0),d=(0,i.useRef)({top:0,bottom:0}),m=(0,i.useRef)(null),g=(0,i.useCallback)(e=>({isDragging:e.isDragging(),clientOffset:e.getClientOffset(),item:e.getItem()}),[]),{isDragging:f,clientOffset:x,item:I}=(0,l.V)(g);(0,i.useEffect)(()=>{m.current=x},[x]);let p=(0,s.VU)();(0,i.useEffect)(()=>{let e=t.current;if(null==e)return;if(!(!0===f&&I?.itemType===n&&!p)){null!==o.current&&cancelAnimationFrame(o.current),o.current=null,e.style.overflowAnchor="auto",e.style.overscrollBehavior="auto",u.current=0;return}let i=e.getBoundingClientRect();return d.current={top:i.top,bottom:i.bottom},e.style.overflowAnchor="none",e.style.overscrollBehavior="contain",o.current=requestAnimationFrame(function t(n){o.current=requestAnimationFrame(t);let i=m.current;if(null==e||null==i){u.current=n;return}let l=Math.min(32,0!==u.current?n-u.current:16)/1e3;u.current=n;let{top:s,bottom:g}=d.current,f=i.y,x=f-s,I=g-f,p=0;if(x>=0&&x<a?p=-r*Math.pow(1-x/a,c):I>=0&&I<a&&(p=r*Math.pow(1-I/a,c)),0!==p){let t=p*l;Math.abs(t)>=1&&(e.scrollTop+=Math.round(t))}}),()=>{null!==o.current&&cancelAnimationFrame(o.current),o.current=null,u.current=0,null!=e&&(e.style.overflowAnchor="auto",e.style.overscrollBehavior="auto")}},[t,f,I?.itemType,n,a,r,c,p])}}