12 |
- !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.MobileDragDrop=n.MobileDragDrop||{})}(this,function(n){"use strict";function t(n){return n===document.body||n===document.documentElement}function e(n,e){var o;if(t(n))o=0===e?n.clientLeft:n.clientTop;else{var r=n.getBoundingClientRect();o=0===e?r.left:r.top}return o}function o(n,e){return t(n)?0===e?window.innerWidth:window.innerHeight:0===e?n.clientWidth:n.clientHeight}function r(n,e,o){var r=0===e?"scrollLeft":"scrollTop",u=t(n);if(2===arguments.length)return u?document.body[r]||document.documentElement[r]:n[r];u?(document.documentElement[r]+=o,document.body[r]+=o):n[r]+=o}function u(n,t,e){return n<e?-1:t-n<e?1:0}function i(n,t,e,o){return-1===n?Math.abs(t-o):1===n?Math.abs(e-t-o):0}function c(n,t,e){var o=0===n?e.scrollX:e.scrollY;return 1===t?o>=(0===n?e.scrollWidth-e.width:e.scrollHeight-e.height):-1!==t||o<=0}var l,f,d,a,s,h={threshold:75,velocityFn:function(n,t){var e=n/t;return e*e*e*t}},v={horizontal:0,vertical:0},w={x:0,y:0};function m(){l||(l=window.requestAnimationFrame(p))}function p(){var n=0,e=0,o=t(a);0!==v.horizontal&&(n=Math.round(h.velocityFn(w.x,h.threshold)*v.horizontal),r(a,0,n)),0!==v.vertical&&(e=Math.round(h.velocityFn(w.y,h.threshold)*v.vertical),r(a,1,e)),o?s(n,e):s(0,0),l=null,y(f,a,h.threshold,v,w)&&m()}function y(n,t,l,f,d){if(!n||!t)return!1;var a={x:e(t,0),y:e(t,1),width:o(t,0),height:o(t,1),scrollX:r(t,0),scrollY:r(t,1),scrollWidth:t.scrollWidth,scrollHeight:t.scrollHeight},s={x:n.x-a.x,y:n.y-a.y};return f.horizontal=u(s.x,a.width,l),f.vertical=u(s.y,a.height,l),f.horizontal&&c(0,f.horizontal,a)?f.horizontal=0:f.horizontal&&(d.x=i(f.horizontal,s.x,a.width,l)),f.vertical&&c(1,f.vertical,a)?f.vertical=0:f.vertical&&(d.y=i(f.vertical,s.y,a.height,l)),!(!f.horizontal&&!f.vertical)}var x=function(n,t,e,o){f=t,s=o,d!==e&&(a=function(n){do{if(!n)return;if(t=n,e=getComputedStyle(t),t.scrollHeight>t.clientHeight&&("scroll"===e.overflowY||"auto"===e.overflowY)||t.scrollWidth>t.clientWidth&&("scroll"===e.overflowX||"auto"===e.overflowX))return n;if(n===document.documentElement)return null}while(n=n.parentNode);var t,e;return null}(d=e)),y(f,a,h.threshold,v,w)?m():l&&(window.cancelAnimationFrame(l),l=null)};n.scrollBehaviourDragImageTranslateOverride=x,Object.defineProperty(n,"__esModule",{value:!0})});
- //# sourceMappingURL=scroll-behaviour.min.js.map
|