forked from varia/web-narrowcast
5 lines
63 KiB
JavaScript
5 lines
63 KiB
JavaScript
|
/* icdnjs.cloudflare.com/ajax/libs/interact.js/1.2.6/interact.min.js */
|
||
|
!function(t){"use strict";function e(){}function i(t){if(!t||"object"!=typeof t)return!1;var e=z(t)||me;return/object|function/.test(typeof e.Element)?t instanceof e.Element:1===t.nodeType&&"string"==typeof t.nodeName}function r(t){return t===me||!(!t||!t.Window)&&t instanceof t.Window}function s(t){return!!t&&t instanceof ye}function n(t){return o(t)&&void 0!==typeof t.length&&a(t.splice)}function o(t){return!!t&&"object"==typeof t}function a(t){return"function"==typeof t}function h(t){return"number"==typeof t}function p(t){return"boolean"==typeof t}function l(t){return"string"==typeof t}function c(t){return l(t)?(fe.querySelector(t),!0):!1}function d(t,e){for(var i in e)t[i]=e[i];return t}function u(t,e){for(var i in e){var r=!1;for(var s in Ke)if(0===i.indexOf(s)&&Ke[s].test(i)){r=!0;break}r||(t[i]=e[i])}return t}function g(t,e){t.page=t.page||{},t.page.x=e.page.x,t.page.y=e.page.y,t.client=t.client||{},t.client.x=e.client.x,t.client.y=e.client.y,t.timeStamp=e.timeStamp}function v(t,e,i){var r=e.length>1?M(e):e[0];x(r,De,i),t.page.x=De.x,t.page.y=De.y,E(r,De,i),t.client.x=De.x,t.client.y=De.y,t.timeStamp=(new Date).getTime()}function m(t,e,i){t.page.x=i.page.x-e.page.x,t.page.y=i.page.y-e.page.y,t.client.x=i.client.x-e.client.x,t.client.y=i.client.y-e.client.y,t.timeStamp=(new Date).getTime()-e.timeStamp;var r=Math.max(t.timeStamp/1e3,.001);t.page.speed=ze(t.page.x,t.page.y)/r,t.page.vx=t.page.x/r,t.page.vy=t.page.y/r,t.client.speed=ze(t.client.x,t.page.y)/r,t.client.vx=t.client.x/r,t.client.vy=t.client.y/r}function f(t){return t instanceof me.Event||ke&&me.Touch&&t instanceof me.Touch}function y(t,e,i){return i=i||{},t=t||"page",i.x=e[t+"X"],i.y=e[t+"Y"],i}function x(t,e){return e=e||{},Ve&&f(t)?(y("screen",t,e),e.x+=me.scrollX,e.y+=me.scrollY):y("page",t,e),e}function E(t,e){return e=e||{},Ve&&f(t)?y("screen",t,e):y("client",t,e),e}function S(t){return t=t||me,{x:t.scrollX||t.document.documentElement.scrollLeft,y:t.scrollY||t.document.documentElement.scrollTop}}function b(t){return h(t.pointerId)?t.pointerId:t.identifier}function w(t){return t instanceof Se?t.correspondingUseElement:t}function z(t){if(r(t))return t;var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||me}function D(t){var e=t instanceof xe?t.getBoundingClientRect():t.getClientRects()[0];return e&&{left:e.left,right:e.right,top:e.top,bottom:e.bottom,width:e.width||e.right-e.left,height:e.height||e.bottom-e.top}}function T(t){var e=D(t);if(!$e&&e){var i=S(z(t));e.left+=i.x,e.right+=i.x,e.top+=i.y,e.bottom+=i.y}return e}function C(t){var e=[];return n(t)?(e[0]=t[0],e[1]=t[1]):"touchend"===t.type?1===t.touches.length?(e[0]=t.touches[0],e[1]=t.changedTouches[0]):0===t.touches.length&&(e[0]=t.changedTouches[0],e[1]=t.changedTouches[1]):(e[0]=t.touches[0],e[1]=t.touches[1]),e}function M(t){for(var e,i={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0},r=0;r<t.length;r++)for(e in i)i[e]+=t[r][e];for(e in i)i[e]/=t.length;return i}function P(t){if(t.length||t.touches&&t.touches.length>1){var e=C(t),i=Math.min(e[0].pageX,e[1].pageX),r=Math.min(e[0].pageY,e[1].pageY),s=Math.max(e[0].pageX,e[1].pageX),n=Math.max(e[0].pageY,e[1].pageY);return{x:i,y:r,left:i,top:r,width:s-i,height:n-r}}}function A(t,e){e=e||Oe.deltaSource;var i=e+"X",r=e+"Y",s=C(t),n=s[0][i]-s[1][i],o=s[0][r]-s[1][r];return ze(n,o)}function O(t,e,i){i=i||Oe.deltaSource;var r=i+"X",s=i+"Y",n=C(t),o=n[0][r]-n[1][r],a=n[0][s]-n[1][s],p=180*Math.atan(a/o)/Math.PI;if(h(e)){var l=p-e,c=l%360;c>315?p-=360+p/360|0:c>135?p-=180+p/360|0:-315>c?p+=360+p/360|0:-135>c&&(p+=180+p/360|0)}return p}function _(t,e){var r=t?t.options.origin:Oe.origin;return"parent"===r?r=F(e):"self"===r?r=t.getRect(e):c(r)&&(r=I(e,r)||{x:0,y:0}),a(r)&&(r=r(t&&e)),i(r)&&(r=T(r)),r.x="x"in r?r.x:r.left,r.y="y"in r?r.y:r.top,r}function k(t,e,i,r){var s=1-t;return s*s*e+2*s*t*i+t*t*r}function X(t,e,i,r,s,n,o){return{x:k(o,t,i,s),y:k(o,e,r,n)}}function Y(t,e,i,r){return t/=r,-i*t*(t-2)+e}function R(t,e){for(;e;){if(e===t)return!0;e=e.parentNode}return!1}function I(t,e){for(var r=F(t);i(r);){if(de(r,e))return r;r=F(r)}re
|
||
|
if(this.prepared.name&&this.target){D&&this.start(this.prepared,this.target,this.element);var T=this.setModifications(this.curCoords.page,n);(T||D)&&(this.prevEvent=this[this.prepared.name+"Move"](e)),this.checkAndPreventDefault(e,this.target,this.element)}}g(this.prevCoords,this.curCoords),(this.dragging||this.resizing)&&this.autoScrollMove(t)}}},dragStart:function(t){var e=new J(this,t,"drag","start",this.element);this.dragging=!0,this.target.fire(e),this.activeDrops.dropzones=[],this.activeDrops.elements=[],this.activeDrops.rects=[],this.dynamicDrop||this.setActiveDrops(this.element);var i=this.getDropEvents(t,e);return i.activate&&this.fireActiveDrops(i.activate),e},dragMove:function(t){var e=this.target,i=new J(this,t,"drag","move",this.element),r=this.element,s=this.getDrop(i,t,r);this.dropTarget=s.dropzone,this.dropElement=s.element;var n=this.getDropEvents(t,i);return e.fire(i),n.leave&&this.prevDropTarget.fire(n.leave),n.enter&&this.dropTarget.fire(n.enter),n.move&&this.dropTarget.fire(n.move),this.prevDropTarget=this.dropTarget,this.prevDropElement=this.dropElement,i},resizeStart:function(t){var e=new J(this,t,"resize","start",this.element);if(this.prepared.edges){var i=this.target.getRect(this.element);if(this.target.options.resize.square||this.target.options.resize.preserveAspectRatio){var r=d({},this.prepared.edges);r.top=r.top||r.left&&!r.bottom,r.left=r.left||r.top&&!r.right,r.bottom=r.bottom||r.right&&!r.top,r.right=r.right||r.bottom&&!r.left,this.prepared._linkedEdges=r}else this.prepared._linkedEdges=null;this.target.options.resize.preserveAspectRatio&&(this.resizeStartAspectRatio=i.width/i.height),this.resizeRects={start:i,current:d({},i),restricted:d({},i),previous:d({},i),delta:{left:0,right:0,width:0,top:0,bottom:0,height:0}},e.rect=this.resizeRects.restricted,e.deltaRect=this.resizeRects.delta}return this.target.fire(e),this.resizing=!0,e},resizeMove:function(t){var e=new J(this,t,"resize","move",this.element),i=this.prepared.edges,r=this.target.options.resize.invert,s="reposition"===r||"negate"===r;if(i){var n=e.dx,o=e.dy,a=this.resizeRects.start,h=this.resizeRects.current,p=this.resizeRects.restricted,l=this.resizeRects.delta,c=d(this.resizeRects.previous,p),u=i;if(this.target.options.resize.preserveAspectRatio){var g=this.resizeStartAspectRatio;i=this.prepared._linkedEdges,u.left&&u.bottom||u.right&&u.top?o=-n/g:u.left||u.right?o=n/g:(u.top||u.bottom)&&(n=o*g)}else this.target.options.resize.square&&(i=this.prepared._linkedEdges,u.left&&u.bottom||u.right&&u.top?o=-n:u.left||u.right?o=n:(u.top||u.bottom)&&(n=o));if(i.top&&(h.top+=o),i.bottom&&(h.bottom+=o),i.left&&(h.left+=n),i.right&&(h.right+=n),s){if(d(p,h),"reposition"===r){var v;p.top>p.bottom&&(v=p.top,p.top=p.bottom,p.bottom=v),p.left>p.right&&(v=p.left,p.left=p.right,p.right=v)}}else p.top=Math.min(h.top,a.bottom),p.bottom=Math.max(h.bottom,a.top),p.left=Math.min(h.left,a.right),p.right=Math.max(h.right,a.left);p.width=p.right-p.left,p.height=p.bottom-p.top;for(var m in p)l[m]=p[m]-c[m];e.edges=this.prepared.edges,e.rect=p,e.deltaRect=l}return this.target.fire(e),e},gestureStart:function(t){var e=new J(this,t,"gesture","start",this.element);return e.ds=0,this.gesture.startDistance=this.gesture.prevDistance=e.distance,this.gesture.startAngle=this.gesture.prevAngle=e.angle,this.gesture.scale=1,this.gesturing=!0,this.target.fire(e),e},gestureMove:function(t){if(!this.pointerIds.length)return this.prevEvent;var e;return e=new J(this,t,"gesture","move",this.element),e.ds=e.scale-this.gesture.scale,this.target.fire(e),this.gesture.prevAngle=e.angle,this.gesture.prevDistance=e.distance,1/0===e.scale||null===e.scale||void 0===e.scale||isNaN(e.scale)||(this.gesture.scale=e.scale),e},pointerHold:function(t,e,i){this.collectEventTargets(t,e,i,"hold")},pointerUp:function(t,e,i,r){var s=this.mouse?0:le(this.pointerIds,b(t));clearTimeout(this.holdTimers[s]),this.collectEventTargets(t,e,i,"up"),this.collectEventTargets(t,e,i,"tap"),this.pointerEnd(t,e,i,r),this.removePointer(t)},pointerCancel:function(t,e,i,r){var s=this.mouse?0:le(this.pointerIds,b(t)
|
||
|
}):t.interact=ne}}("undefined"==typeof window?void 0:window);
|