patashala/assets/js/gsap/utils/Draggable.min.js

14 lines
16 KiB
JavaScript
Raw Permalink Normal View History

/*!
* VERSION: 0.9.5
* DATE: 2013-10-30
* UPDATES AND DOCS AT: http://www.greensock.com
*
* Requires TweenLite and CSSPlugin version 1.11.0 or later (TweenMax contains both TweenLite and CSSPlugin). ThrowPropsPlugin is required for momentum-based continuation of movement after the mouse/touch is released (ThrowPropsPlugin is a membership benefit of Club GreenSock - http://www.greensock.com/club/).
*
* @license Copyright (c) 2008-2013, GreenSock. All rights reserved.
* This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for
* Club GreenSock members, the software agreement that was issued with your membership.
*
* @author: Jack Doyle, jack@greensock.com
*/
(window._gsQueue||(window._gsQueue=[])).push(function(){"use strict";window._gsDefine("utils.Draggable",["events.EventDispatcher","TweenLite"],function(t,e){var i,s,r,n,a={css:{}},o={css:{}},h={css:{}},l={css:{}},u={},_=document,c=_.documentElement||{},p=[],f=function(){return!1},m=180/Math.PI,d=_.all&&!_.addEventListener,g=[],v={},y=0,T=/^(?:a|input|textarea|button|select)$/i,w=0,x=function(){for(var t=g.length;--t>-1;)g[t]()},b=function(t){g.push(t),1===g.length&&e.ticker.addEventListener("tick",x)},P=function(t){for(var i=g.length;--i>-1;)g[i]===t&&g.splice(i,1);e.to(S,0,{overwrite:"all",delay:15,onComplete:S})},S=function(){g.length||e.ticker.removeEventListener("tick",x)},C=function(t,e){var i;for(i in e)void 0===t[i]&&(t[i]=e[i]);return t},k=function(t,e){return t=t||window.event,u.pageX=t.clientX+_.body.scrollLeft+c.scrollLeft,u.pageY=t.clientY+_.body.scrollTop+c.scrollTop,e&&(t.returnValue=!1),u},R=function(t){return t?("string"==typeof t&&(t=e.selector(t)),t.length&&t!==window&&t[0]&&t[0].style&&!t.nodeType&&(t=t[0]),t===window||t.nodeType&&t.style?t:null):t},A=function(t,e){var s,r,n,a=t.style;if(void 0===a[e]){for(n=["O","Moz","ms","Ms","Webkit"],r=5,s=e.charAt(0).toUpperCase()+e.substr(1);--r>-1&&void 0===a[n[r]+s];);if(0>r)return"";i=3===r?"ms":n[r],e=i+s}return e},D=function(t,e,i){var s=t.style;void 0===s[e]&&(e=A(t,e)),null==i?s.removeProperty?s.removeProperty(e.replace(/([A-Z])/g,"-$1").toLowerCase()):s.removeAttribute(e):void 0!==s[e]&&(s[e]=i)},O=_.defaultView?_.defaultView.getComputedStyle:f,M=function(t,e,i){var s,r=(t._gsTransform||{})[e];return r||0===r?r:(t.style[e]?r=t.style[e]:(s=O(t))?(t=s.getPropertyValue(e.replace(/([A-Z])/g,"-$1").toLowerCase()),r=t||s.length?t:s[e]):t.currentStyle&&(r=t.currentStyle[e]),i?r:parseFloat(r)||0)},L=function(t,e,i){var s=t.vars,r=s[i],n=t._listeners[e];"function"==typeof r&&r.apply(s[i+"Scope"]||t,s[i+"Params"]||[t.pointerEvent]),n&&t.dispatchEvent(e)},E={x:0,y:0},I=function(t,e){var i,s,r,n,a,o,h,l,u=R(t);if(!u)return l=t.min||t.minX||t.minRotation||0,h=t.min||t.minY||0,void 0!==t.left?t:{left:l,top:h,width:(t.max||t.maxX||t.maxRotation||0)-l,height:(t.max||t.maxY||0)-h};if(i=null!=u.pageYOffset?u.pageYOffset:null!=_.scrollTop?_.scrollTop:_.body.scrollTop||c.scrollTop||0,s=null!=u.pageXOffset?u.pageXOffset:null!=_.scrollLeft?_.scrollLeft:_.body.scrollLeft||c.scrollLeft||0,u===window)return{top:i,left:s,width:c.clientWidth||u.innerWidth||_.body.clientWidth||0,height:u.innerHeight-20<c.clientHeight?c.clientHeight:u.innerHeight||_.body.clientHeight||0};if(e){for(a=u.offsetWidth,o=u.offsetHeight,h=u.offsetTop,l=u.offsetLeft;u=u.offsetParent;)h+=u.offsetTop,l+=u.offsetLeft;return{top:h,left:l,width:a,height:o}}return r=u.getBoundingClientRect(),n=u._gsTransform||E,{top:r.top-n.y+i,left:r.left-n.x+s,width:r.right-r.left,height:r.bottom-r.top}},N=_.createElement("div"),F=A(N,"transformOrigin").replace(/([A-Z])/g,"-$1").toLowerCase(),X=A(N,"transform"),U=""!==A(N,"perspective"),Y=function(t){var e=I(t,!0),i=O(t),s=F&&i?i.getPropertyValue(F):"50% 50%",r=s.split(" "),n=-1!==s.indexOf("left")?"0%":-1!==s.indexOf("right")?"100%":r[0],a=-1!==s.indexOf("top")?"0%":-1!==s.indexOf("bottom")?"100%":r[1],o=t._gsTransform||E;return("center"===a||null==a)&&(a="50%"),("center"===n||isNaN(parseFloat(n)))&&(n="50%"),e.left+=o.x+(-1!==n.indexOf("%")?e.width*parseFloat(n)/100:parseFloat(n)),e.top+=o.y+(-1!==a.indexOf("%")?e.height*parseFloat(a)/100:parseFloat(a)),e},B=function(t){return t.length&&t[0]&&(t[0].nodeType&&t[0].style&&!t.nodeType||t[0].length&&t[0][0])?!0:!1},z=function(t){var e,i,s,r=[],n=t.length;for(e=0;n>e;e++)if(i=t[e],B(i))for(s=i.length,s=0;i.length>s;s++)r.push(i[s]);else r.push(i);return r},j="ontouchstart"in c&&"orientation"in window,q=function(t){for(var e=t.split(","),i=(void 0!==N.onmspointerdown?"MSPointerDown,MSPointerMove,MSPointerUp,MSPointerCancel":void 0!==N.onpointerdown?"pointerdown,pointermove,pointerup,pointercancel":t).split(","),s={},r=7;--r>-1;)s[e[r]]=i[r],s[i[r]]=e[r];return s}("touchstart,touchmove,touchend,touchcancel"),V=function(t,e,i){t.add