greensock-rails 1.11.8.0 → 1.12.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 0.1.7
3
- * DATE: 2014-04-29
2
+ * VERSION: 0.1.8
3
+ * DATE: 2014-06-21
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com/jquery-gsap-plugin/
5
5
  *
6
6
  * Requires TweenLite version 1.8.0 or higher and CSSPlugin.
@@ -137,7 +137,7 @@
137
137
 
138
138
  if (config.queue !== false) {
139
139
  obj.queue(config.queue, doAnimation); //note: the queued function will get called once for each element in the jQuery collection.
140
- if (config.old) {
140
+ if (typeof(config.old) === "function") {
141
141
  obj.queue(config.queue, function(next) {
142
142
  config.old();
143
143
  next();
@@ -170,6 +170,6 @@
170
170
  return this;
171
171
  };
172
172
 
173
- $.gsap = {enabled:function(value) {_enabled = value;}, version:"0.1.7"};
173
+ $.gsap = {enabled:function(value) {_enabled = value;}, version:"0.1.8"};
174
174
 
175
175
  }(jQuery));
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 0.3.0
3
- * DATE: 2014-05-13
2
+ * VERSION: 0.3.2
3
+ * DATE: 2014-05-23
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
@@ -16,7 +16,7 @@
16
16
  window._gsDefine.plugin({
17
17
  propName: "attr",
18
18
  API: 2,
19
- version: "0.3.0",
19
+ version: "0.3.2",
20
20
 
21
21
  //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
22
22
  init: function(target, value, tween) {
@@ -28,11 +28,10 @@
28
28
  this._proxy = {};
29
29
  this._start = {}; // we record start and end values exactly as they are in case they're strings (not numbers) - we need to be able to revert to them cleanly.
30
30
  this._end = {};
31
- this._endRatio = tween.vars.runBackwards ? 0 : 1;
32
31
  for (p in value) {
33
32
  this._start[p] = this._proxy[p] = start = target.getAttribute(p);
34
- this._end[p] = end = value[p];
35
- this._addTween(this._proxy, p, parseFloat(start), end, p);
33
+ end = this._addTween(this._proxy, p, parseFloat(start), value[p], p);
34
+ this._end[p] = end ? end.s + end.c : value[p];
36
35
  this._overwriteProps.push(p);
37
36
  }
38
37
  return true;
@@ -43,7 +42,7 @@
43
42
  this._super.setRatio.call(this, ratio);
44
43
  var props = this._overwriteProps,
45
44
  i = props.length,
46
- lookup = (ratio !== 0 && ratio !== 1) ? this._proxy : (ratio === this._endRatio) ? this._end : this._start,
45
+ lookup = (ratio === 1) ? this._end : ratio ? this._proxy : this._start,
47
46
  p;
48
47
  while (--i > -1) {
49
48
  p = props[i];
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.11.8
3
- * DATE: 2014-05-13
2
+ * VERSION: 1.12.1
3
+ * DATE: 2014-06-26
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
@@ -29,7 +29,7 @@
29
29
  p = CSSPlugin.prototype = new TweenPlugin("css");
30
30
 
31
31
  p.constructor = CSSPlugin;
32
- CSSPlugin.version = "1.11.8";
32
+ CSSPlugin.version = "1.12.1";
33
33
  CSSPlugin.API = 2;
34
34
  CSSPlugin.defaultTransformPerspective = 0;
35
35
  CSSPlugin.defaultSkewType = "compensated";
@@ -42,8 +42,8 @@
42
42
  _valuesExp = /(?:\+=|\-=|\-|\b)[\d\-\.]+[a-zA-Z0-9]*(?:%|\b)/gi, //finds all the values that begin with numbers or += or -= and then a number. Includes suffixes. We use this to split complex values apart like "1px 5px 20px rgb(255,102,51)"
43
43
  _NaNExp = /[^\d\-\.]/g,
44
44
  _suffixExp = /(?:\d|\-|\+|=|#|\.)*/g,
45
- _opacityExp = /opacity *= *([^)]*)/,
46
- _opacityValExp = /opacity:([^;]*)/,
45
+ _opacityExp = /opacity *= *([^)]*)/i,
46
+ _opacityValExp = /opacity:([^;]*)/i,
47
47
  _alphaFilterExp = /alpha\(opacity *=.+?\)/i,
48
48
  _rgbhslExp = /^(rgb|hsl)/,
49
49
  _capsExp = /([A-Z])/g,
@@ -136,7 +136,7 @@
136
136
  }
137
137
  if (!calc && t.style[p]) {
138
138
  rv = t.style[p];
139
- } else if ((cs = cs || _getComputedStyle(t, null))) {
139
+ } else if ((cs = cs || _getComputedStyle(t))) {
140
140
  rv = cs[p] || cs.getPropertyValue(p) || cs.getPropertyValue(p.replace(_capsExp, "-$1").toLowerCase());
141
141
  } else if (t.currentStyle) {
142
142
  rv = t.currentStyle[p];
@@ -1320,6 +1320,10 @@
1320
1320
  perspective = t.perspective,
1321
1321
  a11, a12, a13, a14, a21, a22, a23, a24, a31, a32, a33, a34, a41, a42, a43,
1322
1322
  zOrigin, rnd, cos, sin, t1, t2, t3, t4;
1323
+ if (v === 1 || v === 0) if (t.force3D === "auto") if (!t.rotationY && !t.rotationX && sz === 1 && !perspective && !t.z) { //on the final render (which could be 0 for a from tween), if there are no 3D aspects, render in 2D to free up memory and improve performance especially on mobile devices
1324
+ _set2DTransformRatio.call(this, v);
1325
+ return;
1326
+ }
1323
1327
  if (_isFirefox) {
1324
1328
  var n = 0.0001;
1325
1329
  if (sx < n && sx > -n) { //Firefox has a bug (at least in v25) that causes it to render the transparent part of 32-bit PNG images as black when displayed inside an iframe and the 3D scale is very small and doesn't change sufficiently enough between renders (like if you use a Power4.easeInOut to scale from 0 to 1 where the beginning values only change a tiny amount to begin the tween before accelerating). In this case, we force the scale to be 0.00002 instead which is visually the same but works around the Firefox issue.
@@ -1429,7 +1433,7 @@
1429
1433
  targ = this.t,
1430
1434
  style = targ.style,
1431
1435
  ang, skew, rnd, sx, sy;
1432
- if (t.rotationX || t.rotationY || t.z || t.force3D) { //if a 3D tween begins while a 2D one is running, we need to kick the rendering over to the 3D method. For example, imagine a yoyo-ing, infinitely repeating scale tween running, and then the object gets rotated in 3D space with a different tween.
1436
+ if (t.rotationX || t.rotationY || t.z || t.force3D === true || (t.force3D === "auto" && v !== 1 && v !== 0)) { //if a 3D tween begins while a 2D one is running, we need to kick the rendering over to the 3D method. For example, imagine a yoyo-ing, infinitely repeating scale tween running, and then the object gets rotated in 3D space with a different tween.
1433
1437
  this.setRatio = _set3DTransformRatio;
1434
1438
  _set3DTransformRatio.call(this, v);
1435
1439
  return;
@@ -1457,11 +1461,13 @@
1457
1461
  endRotations = {},
1458
1462
  m2, skewY, copy, orig, has3D, hasChange, dr;
1459
1463
  if (typeof(v.transform) === "string" && _transformProp) { //for values like transform:"rotate(60deg) scale(0.5, 0.8)"
1460
- copy = style.cssText;
1461
- style[_transformProp] = v.transform;
1462
- style.display = "block"; //if display is "none", the browser often refuses to report the transform properties correctly.
1463
- m2 = _getTransform(t, null, false);
1464
- style.cssText = copy;
1464
+ copy = _tempDiv.style; //don't use the original target because it might be SVG in which case some browsers don't report computed style correctly.
1465
+ copy[_transformProp] = v.transform;
1466
+ copy.display = "block"; //if display is "none", the browser often refuses to report the transform properties correctly.
1467
+ copy.position = "absolute";
1468
+ _doc.body.appendChild(_tempDiv);
1469
+ m2 = _getTransform(_tempDiv, null, false);
1470
+ _doc.body.removeChild(_tempDiv);
1465
1471
  } else if (typeof(v) === "object") { //for values like scaleX, scaleY, rotation, x, y, skewX, and skewY or transform:{...} (object)
1466
1472
  m2 = {scaleX:_parseVal((v.scaleX != null) ? v.scaleX : v.scale, m1.scaleX),
1467
1473
  scaleY:_parseVal((v.scaleY != null) ? v.scaleY : v.scale, m1.scaleY),
@@ -1535,12 +1541,12 @@
1535
1541
  copy = m1.zOrigin;
1536
1542
  orig = orig.split(" ");
1537
1543
  m1.zOrigin = ((orig.length > 2 && !(copy !== 0 && orig[2] === "0px")) ? parseFloat(orig[2]) : copy) || 0; //Safari doesn't handle the z part of transformOrigin correctly, so we'll manually handle it in the _set3DTransformRatio() method.
1538
- pt.xs0 = pt.e = style[p] = orig[0] + " " + (orig[1] || "50%") + " 0px"; //we must define a z value of 0px specifically otherwise iOS 5 Safari will stick with the old one (if one was defined)!
1544
+ pt.xs0 = pt.e = orig[0] + " " + (orig[1] || "50%") + " 0px"; //we must define a z value of 0px specifically otherwise iOS 5 Safari will stick with the old one (if one was defined)!
1539
1545
  pt = new CSSPropTween(m1, "zOrigin", 0, 0, pt, -1, pt.n); //we must create a CSSPropTween for the _gsTransform.zOrigin so that it gets reset properly at the beginning if the tween runs backward (as opposed to just setting m1.zOrigin here)
1540
1546
  pt.b = copy;
1541
1547
  pt.xs0 = pt.e = m1.zOrigin;
1542
1548
  } else {
1543
- pt.xs0 = pt.e = style[p] = orig;
1549
+ pt.xs0 = pt.e = orig;
1544
1550
  }
1545
1551
 
1546
1552
  //for older versions of IE (6-8), we need to manually calculate things inside the setRatio() function. We record origin x and y (ox and oy) and whether or not the values are percentages (oxp and oyp).
@@ -1695,7 +1701,7 @@
1695
1701
  if (this.xn1) {
1696
1702
  t.filter = filters = filters || ("alpha(opacity=" + val + ")"); //works around bug in IE7/8 that prevents changes to "visibility" from being applied properly if the filter is changed to a different alpha on the same frame.
1697
1703
  }
1698
- if (filters.indexOf("opacity") === -1) { //only used if browser doesn't support the standard opacity style property (IE 7 and 8)
1704
+ if (filters.indexOf("pacity") === -1) { //only used if browser doesn't support the standard opacity style property (IE 7 and 8). We omit the "O" to avoid case-sensitivity issues
1699
1705
  if (val !== 0 || !this.xn1) { //bugs in IE7/8 won't render the filter properly if opacity is ADDED on the same frame/render as "visibility" changes (this.xn1 is 1 if this tween is an "autoAlpha" tween)
1700
1706
  t.filter = filters + " alpha(opacity=" + val + ")"; //we round the value because otherwise, bugs in IE7/8 can prevent "visibility" changes from being applied properly.
1701
1707
  }
@@ -1752,7 +1758,7 @@
1752
1758
  _setClassNameRatio = function(v) {
1753
1759
  this.t._gsClassPT = this;
1754
1760
  if (v === 1 || v === 0) {
1755
- this.t.className = (v === 0) ? this.b : this.e;
1761
+ this.t.setAttribute("class", (v === 0) ? this.b : this.e);
1756
1762
  var mpt = this.data, //first MiniPropTween
1757
1763
  s = this.t.style;
1758
1764
  while (mpt) {
@@ -1766,12 +1772,12 @@
1766
1772
  if (v === 1 && this.t._gsClassPT === this) {
1767
1773
  this.t._gsClassPT = null;
1768
1774
  }
1769
- } else if (this.t.className !== this.e) {
1770
- this.t.className = this.e;
1775
+ } else if (this.t.getAttribute("class") !== this.e) {
1776
+ this.t.setAttribute("class", this.e);
1771
1777
  }
1772
1778
  };
1773
1779
  _registerComplexSpecialProp("className", {parser:function(t, e, p, cssp, pt, plugin, vars) {
1774
- var b = t.className,
1780
+ var b = t.getAttribute("class") || "", //don't use t.className because it doesn't work consistently on SVG elements; getAttribute("class") and setAttribute("class", value") is more reliable.
1775
1781
  cssText = t.style.cssText,
1776
1782
  difData, bs, cnpt, cnptLookup, mpt;
1777
1783
  pt = cssp._classNamePT = new CSSPropTween(t, p, 0, 0, pt, 2);
@@ -1794,9 +1800,9 @@
1794
1800
  t._gsClassPT = pt;
1795
1801
  pt.e = (e.charAt(1) !== "=") ? e : b.replace(new RegExp("\\s*\\b" + e.substr(2) + "\\b"), "") + ((e.charAt(0) === "+") ? " " + e.substr(2) : "");
1796
1802
  if (cssp._tween._duration) { //if it's a zero-duration tween, there's no need to tween anything or parse the data. In fact, if we switch classes temporarily (which we must do for proper parsing) and the class has a transition applied, it could cause a quick flash to the end state and back again initially in some browsers.
1797
- t.className = pt.e;
1803
+ t.setAttribute("class", pt.e);
1798
1804
  difData = _cssDif(t, bs, _getAllStyles(t), vars, cnptLookup);
1799
- t.className = b;
1805
+ t.setAttribute("class", b);
1800
1806
  pt.data = difData.firstMPT;
1801
1807
  t.style.cssText = cssText; //we recorded cssText before we swapped classes and ran _getAllStyles() because in cases when a className tween is overwritten, we remove all the related tweening properties from that class change (otherwise class-specific stuff can't override properties we've directly set on the target's style object due to specificity).
1802
1808
  pt = pt.xfirst = cssp.parse(t, difData.difs, pt, plugin); //we record the CSSPropTween as the xfirst so that we can handle overwriting propertly (if "className" gets overwritten, we must kill all the properties associated with the className part of the tween, so we can loop through from xfirst to the pt itself)
@@ -1882,7 +1888,7 @@
1882
1888
  v = _getStyle(target, "zIndex", _cs);
1883
1889
  if (v === "auto" || v === "") {
1884
1890
  //corrects a bug in [non-Android] Safari that prevents it from repainting elements in their new positions if they don't have a zIndex set. We also can't just apply this inside _parseTransform() because anything that's moved in any way (like using "left" or "top" instead of transforms like "x" and "y") can be affected, so it is best to ensure that anything that's tweening has a z-index. Setting "WebkitPerspective" to a non-zero value worked too except that on iOS Safari things would flicker randomly. Plus zIndex is less memory-intensive.
1885
- style.zIndex = 0;
1891
+ this._addLazySet(style, "zIndex", 0);
1886
1892
  }
1887
1893
  }
1888
1894
 
@@ -1909,7 +1915,7 @@
1909
1915
  if (style.zIndex === "") {
1910
1916
  zIndex = _getStyle(target, "zIndex", _cs);
1911
1917
  if (zIndex === "auto" || zIndex === "") {
1912
- style.zIndex = 0;
1918
+ this._addLazySet(style, "zIndex", 0);
1913
1919
  }
1914
1920
  }
1915
1921
  //Setting WebkitBackfaceVisibility corrects 3 bugs:
@@ -1918,7 +1924,7 @@
1918
1924
  // 3) Safari sometimes displayed odd artifacts when tweening the transform (or WebkitTransform) property, like ghosts of the edges of the element remained. Definitely a browser bug.
1919
1925
  //Note: we allow the user to override the auto-setting by defining WebkitBackfaceVisibility in the vars of the tween.
1920
1926
  if (_isSafariLT6) {
1921
- style.WebkitBackfaceVisibility = this._vars.WebkitBackfaceVisibility || (threeD ? "visible" : "hidden");
1927
+ this._addLazySet(style, "WebkitBackfaceVisibility", this._vars.WebkitBackfaceVisibility || (threeD ? "visible" : "hidden"));
1922
1928
  }
1923
1929
  }
1924
1930
  pt2 = pt;
@@ -2144,6 +2150,18 @@
2144
2150
  this._transform = this._transform || _getTransform(this._target, _cs, true); //ensures that the element has a _gsTransform property with the appropriate values.
2145
2151
  };
2146
2152
 
2153
+ var lazySet = function(v) {
2154
+ this.t[this.p] = this.e;
2155
+ this.data._linkCSSP(this, this._next, null, true); //we purposefully keep this._next even though it'd make sense to null it, but this is a performance optimization, as this happens during the while (pt) {} loop in setRatio() at the bottom of which it sets pt = pt._next, so if we null it, the linked list will be broken in that loop.
2156
+ };
2157
+ /** @private Gives us a way to set a value on the first render (and only the first render). **/
2158
+ p._addLazySet = function(t, p, v) {
2159
+ var pt = this._firstPT = new CSSPropTween(t, p, 0, 0, this._firstPT, 2);
2160
+ pt.e = v;
2161
+ pt.setRatio = lazySet;
2162
+ pt.data = this;
2163
+ };
2164
+
2147
2165
  /** @private **/
2148
2166
  p._linkCSSP = function(pt, next, prev, remove) {
2149
2167
  if (pt) {
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 0.10.3
3
- * DATE: 2014-05-13
2
+ * VERSION: 0.10.4
3
+ * DATE: 2014-06-25
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * 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/).
@@ -237,6 +237,47 @@
237
237
  _point1 = {}, //we reuse _point1 and _point2 objects inside matrix and point conversion methods to conserve memory and minimize garbage collection tasks.
238
238
  _point2 = {},
239
239
  _hasReparentBug, //we'll set this inside the _getOffset2DMatrix() method after the body has loaded.
240
+ _dummySVGRect = (function() {
241
+ if (_isOldIE) {
242
+ return;
243
+ }
244
+ var url = "http://www.w3.org/2000/svg",
245
+ svg = _doc.createElementNS(url, "svg"),
246
+ e = _doc.createElementNS(url, "rect");
247
+ e.setAttributeNS(null, "width", "10");
248
+ e.setAttributeNS(null, "height", "10");
249
+ svg.appendChild(e);
250
+ return svg;
251
+ }()),
252
+ _getSVGOffsets = function(e) { //SVG elements don't always report offsetTop/offsetLeft/offsetParent at all (I'm looking at you, Firefox 29), so we have to do some work to manufacture those values.
253
+ if (!e.getBoundingClientRect || !e.parentNode) {
254
+ return {offsetTop:0, offsetLeft:0, offsetParent:_docElement};
255
+ }
256
+ var curElement = e,
257
+ prevCSS = e.style.cssText,
258
+ eRect, parentRect, offsetParent;
259
+ while (!curElement.offsetParent && curElement.parentNode) {
260
+ curElement = curElement.parentNode;
261
+ }
262
+ e.parentNode.insertBefore(_dummySVGRect, e); //Firefox measures things based NOT on the <svg> itself, but on the bounds of the child elements, so we add a dummy SVG object temporarily in the original one's spot which has a 1x1 <rect> in the upper left corner to make sure we're getting accurate results.
263
+ e.parentNode.removeChild(e);
264
+ _dummySVGRect.style.cssText = prevCSS;
265
+ _dummySVGRect.style[_transformProp] = "none";
266
+ _dummySVGRect.setAttribute("class", e.getAttribute("class"));
267
+ eRect = _dummySVGRect.getBoundingClientRect();
268
+ offsetParent = curElement.offsetParent;
269
+ if (offsetParent) {
270
+ if (offsetParent === _doc.body && _docElement) {
271
+ offsetParent = _docElement; //to avoid problems with margins/padding on the <body>
272
+ }
273
+ parentRect = offsetParent.getBoundingClientRect();
274
+ } else {
275
+ parentRect = {top:-_getDocScrollTop(), left:-_getDocScrollLeft()};
276
+ }
277
+ _dummySVGRect.parentNode.insertBefore(e, _dummySVGRect);
278
+ e.parentNode.removeChild(_dummySVGRect);
279
+ return {offsetLeft:eRect.left - parentRect.left, offsetTop:eRect.top - parentRect.top, offsetParent:curElement.offsetParent || _docElement};
280
+ },
240
281
  _getOffsetTransformOrigin = function(e, decoratee) {
241
282
  decoratee = decoratee || {};
242
283
  if (!e || e === _docElement || !e.parentNode) {
@@ -258,7 +299,7 @@
258
299
  return decoratee;
259
300
  },
260
301
  _getOffset2DMatrix = function(e, offsetOrigin, parentOffsetOrigin) {
261
- var cs, m, parent, offsetParent, isRoot;
302
+ var cs, m, parent, offsetParent, isRoot, offsets;
262
303
  if (e === window || !e || !e.parentNode) {
263
304
  return [1,0,0,1,0,0];
264
305
  }
@@ -270,10 +311,11 @@
270
311
  }
271
312
  if (offsetOrigin) {
272
313
  parent = e.parentNode;
273
- offsetParent = e.offsetParent;
314
+ offsets = (e.offsetLeft === undefined && e.nodeName.toLowerCase() === "svg") ? _getSVGOffsets(e) : e;
315
+ offsetParent = offsets.offsetParent;
274
316
  isRoot = (parent === _docElement || parent === _doc.body);
275
- m[4] = Number(m[4]) + offsetOrigin.x + e.offsetLeft - parentOffsetOrigin.x - (isRoot ? 0 : parent.scrollLeft) + (offsetParent ? parseInt(_getStyle(offsetParent, "borderLeftWidth"), 10) || 0 : 0);
276
- m[5] = Number(m[5]) + offsetOrigin.y + e.offsetTop - parentOffsetOrigin.y - (isRoot ? 0 : parent.scrollTop) + (offsetParent ? parseInt(_getStyle(offsetParent, "borderTopWidth"), 10) || 0 : 0);
317
+ m[4] = Number(m[4]) + offsetOrigin.x + (offsets.offsetLeft || 0) - parentOffsetOrigin.x - (isRoot ? 0 : parent.scrollLeft) + (offsetParent ? parseInt(_getStyle(offsetParent, "borderLeftWidth"), 10) || 0 : 0);
318
+ m[5] = Number(m[5]) + offsetOrigin.y + (offsets.offsetTop || 0) - parentOffsetOrigin.y - (isRoot ? 0 : parent.scrollTop) + (offsetParent ? parseInt(_getStyle(offsetParent, "borderTopWidth"), 10) || 0 : 0);
277
319
  if (!offsetParent && _getStyle(e, "position", cs) === "fixed") { //fixed position elements should factor in the scroll position of the document.
278
320
  m[4] += _getDocScrollLeft();
279
321
  m[5] += _getDocScrollTop();
@@ -295,9 +337,9 @@
295
337
  return value;
296
338
  }());
297
339
  }
298
- if (parent && parent.offsetParent === e.offsetParent && (!_hasReparentBug || _getOffset2DMatrix(parent).join("") === "100100")) {
299
- m[4] -= parent.offsetLeft;
300
- m[5] -= parent.offsetTop;
340
+ if (parent && parent.offsetParent === offsetParent && (!_hasReparentBug || _getOffset2DMatrix(parent).join("") === "100100")) {
341
+ m[4] -= parent.offsetLeft || 0;
342
+ m[5] -= parent.offsetTop || 0;
301
343
  }
302
344
  }
303
345
  return m;
@@ -364,7 +406,8 @@
364
406
  top = _getDocScrollTop();
365
407
  left = _getDocScrollLeft();
366
408
  right = left + (_docElement.clientWidth || e.innerWidth || _doc.body.clientWidth || 0);
367
- bottom = top + ((e.innerHeight - 20 < _docElement.clientHeight) ? _docElement.clientHeight : e.innerHeight || _doc.body.clientHeight || 0); //some browsers (like Firefox) ignore absolutely positioned elements, and collapse the height of the documentElement, so it could be 8px, for example, if you have just an absolutely positioned div. In that case, we use the innerHeight to resolve this.
409
+
410
+ bottom = top + (((e.innerHeight || 0) - 20 < _docElement.clientHeight) ? _docElement.clientHeight : e.innerHeight || _doc.body.clientHeight || 0); //some browsers (like Firefox) ignore absolutely positioned elements, and collapse the height of the documentElement, so it could be 8px, for example, if you have just an absolutely positioned div. In that case, we use the innerHeight to resolve this. Also note that IE8 doesn't support window.innerHeight.
368
411
  } else {
369
412
  origin = _getOffsetTransformOrigin(e);
370
413
  left = -origin.x;
@@ -748,7 +791,7 @@
748
791
  trigger = _unwrapElement(vars.trigger || vars.handle || target),
749
792
  killProps = {},
750
793
  dragEndTime = 0,
751
- scrollProxy, startMouseX, startMouseY, startElementX, startElementY, hasBounds, hasDragCallback, maxX, minX, maxY, minY, tempVars, cssVars, touch, touchID, rotationOrigin, dirty, old, snapX, snapY, isClicking, touchEventTarget, lockedAxis, matrix, interrupted,
794
+ enabled, scrollProxy, startMouseX, startMouseY, startElementX, startElementY, hasBounds, hasDragCallback, maxX, minX, maxY, minY, tempVars, cssVars, touch, touchID, rotationOrigin, dirty, old, snapX, snapY, isClicking, touchEventTarget, lockedAxis, matrix, interrupted,
752
795
 
753
796
  //this method gets called on every tick of TweenLite.ticker which allows us to synchronize the renders to the core engine (which is typically synchronized with the display refresh via requestAnimationFrame). This is an optimization - it's better than applying the values inside the "mousemove" or "touchmove" event handler which may get called many times inbetween refreshes.
754
797
  render = function(suppressEvents) {
@@ -931,7 +974,7 @@
931
974
  if (scrollProxy) {
932
975
  scrollProxy._suspendTransforms = true; //Microsoft browsers have a bug that causes them to briefly render the position incorrectly (it flashes to the end state when we seek() the tween even though we jump right back to the current position, and this only seems to happen when we're affecting both top and left), so we set a _suspendTransforms flag to prevent it from actually applying the values in the ScrollProxy.
933
976
  }
934
- tween.seek(tween.duration());
977
+ tween.render(tween.duration(), true, true);
935
978
  syncXY(true, true);
936
979
  self.endX = self.x;
937
980
  self.endY = self.y;
@@ -1034,7 +1077,7 @@
1034
1077
  //called when the mouse is pressed (or touch starts)
1035
1078
  onPress = function(e) {
1036
1079
  var temp;
1037
- if (self.isPressed || !e) { //just in case the browser dispatches a "touchstart" and "mousedown" (some browsers emulate mouse events when using touches)
1080
+ if (!enabled || self.isPressed || !e) { //just in case the browser dispatches a "touchstart" and "mousedown" (some browsers emulate mouse events when using touches)
1038
1081
  return;
1039
1082
  }
1040
1083
  interrupted = isTweening();
@@ -1057,7 +1100,7 @@
1057
1100
  }
1058
1101
  if (_isOldIE) {
1059
1102
  e = _populateIEEvent(e, true);
1060
- } else if (!(e.touches && e.touches.length > _dragCount + 1)) { //in some mobile browsers, e.preventDefault() when pressing on a link (or element with an onclick) will cause the link not to work.
1103
+ } else if (scrollProxy && !(e.touches && e.touches.length > _dragCount + 1)) { //in some mobile browsers, e.preventDefault() when pressing on a link (or element with an onclick) will cause the link not to work. Only preventDefault() on scroll-type interactions, otherwise things like touch checkboxes and inputs don't work.
1061
1104
  e.preventDefault();
1062
1105
  if (e.preventManipulation) {
1063
1106
  e.preventManipulation(); //for some Microsoft browsers
@@ -1102,7 +1145,7 @@
1102
1145
 
1103
1146
  //called every time the mouse/touch moves
1104
1147
  onMove = function(e) {
1105
- if (_isMultiTouching || !self.isPressed) {
1148
+ if (!enabled || _isMultiTouching || !self.isPressed) {
1106
1149
  return;
1107
1150
  }
1108
1151
  if (_isOldIE) {
@@ -1209,7 +1252,7 @@
1209
1252
 
1210
1253
  //called when the mouse/touch is released
1211
1254
  onRelease = function(e, force) {
1212
- if (e && touchID && !force && e.pointerId && e.pointerId !== touchID) { //for some Microsoft browsers, we must attach the listener to the doc rather than the trigger so that when the finger moves outside the bounds of the trigger, things still work. So if the event we're receiving has a pointerId that doesn't match the touchID, ignore it (for multi-touch)
1255
+ if (!enabled || e && touchID && !force && e.pointerId && e.pointerId !== touchID) { //for some Microsoft browsers, we must attach the listener to the doc rather than the trigger so that when the finger moves outside the bounds of the trigger, things still work. So if the event we're receiving has a pointerId that doesn't match the touchID, ignore it (for multi-touch)
1213
1256
  return;
1214
1257
  }
1215
1258
  self.isPressed = false;
@@ -1271,7 +1314,7 @@
1271
1314
  _dispatchEvent(self, "click", "onClick");
1272
1315
  } else {
1273
1316
  animate(vars.throwProps); //will skip if throwProps isn't defined or ThrowPropsPlugin isn't loaded.
1274
- if (!_isOldIE && originalEvent && (vars.dragClickables || !_isClickable(originalEvent.target))) {
1317
+ if (!_isOldIE && originalEvent && (vars.dragClickables || !_isClickable(originalEvent.target)) && wasDragging) {
1275
1318
  originalEvent.preventDefault();
1276
1319
  if (originalEvent.preventManipulation) {
1277
1320
  originalEvent.preventManipulation(); //for some Microsoft browsers
@@ -1368,25 +1411,28 @@
1368
1411
  } else {
1369
1412
  syncXY(true);
1370
1413
  }
1371
- if (self.isPressed && (x !== self.x || (y !== self.y && !rotationMode))) {
1414
+ if (self.isPressed && (Math.abs(x - self.x) > 0.01 || (Math.abs(y - self.y) > 0.01 && !rotationMode))) {
1372
1415
  recordStartPositions();
1373
1416
  }
1374
1417
  return self;
1375
1418
  };
1376
1419
 
1377
- this.enable = function() {
1420
+ this.enable = function(type) {
1378
1421
  var id;
1379
- _addListener(trigger, "mousedown", onPress);
1380
- _addListener(trigger, "touchstart", onPress);
1381
- _addListener(trigger, "click", onClick);
1382
- if (!rotationMode) {
1383
- _setStyle(trigger, "cursor", vars.cursor || "move");
1422
+ if (type !== "soft") {
1423
+ _addListener(trigger, "mousedown", onPress);
1424
+ _addListener(trigger, "touchstart", onPress);
1425
+ _addListener(trigger, "click", onClick);
1426
+ if (!rotationMode) {
1427
+ _setStyle(trigger, "cursor", vars.cursor || "move");
1428
+ }
1429
+ trigger.ondragstart = trigger.onselectstart = _emptyFunc; //prevent text selection (and prevent IE from dragging images)
1430
+ _setStyle(trigger, "userSelect", "none");
1431
+ _setStyle(trigger, "touchCallout", "none");
1432
+ _setStyle(trigger, "touchAction", "none");
1384
1433
  }
1385
- trigger.ondragstart = trigger.onselectstart = _emptyFunc; //prevent text selection (and prevent IE from dragging images)
1386
- _setStyle(trigger, "userSelect", "none");
1387
- _setStyle(trigger, "touchCallout", "none");
1388
- _setStyle(trigger, "touchAction", "none");
1389
- if (ThrowPropsPlugin) {
1434
+ enabled = true;
1435
+ if (ThrowPropsPlugin && type !== "soft") {
1390
1436
  ThrowPropsPlugin.track(scrollProxy || target, (xyMode ? "x,y" : rotationMode ? "rotation" : "top,left"));
1391
1437
  }
1392
1438
  if (scrollProxy) {
@@ -1402,26 +1448,29 @@
1402
1448
  return self;
1403
1449
  };
1404
1450
 
1405
- this.disable = function() {
1451
+ this.disable = function(type) {
1406
1452
  var dragging = this.isDragging;
1407
1453
  if (!rotationMode) {
1408
1454
  _setStyle(trigger, "cursor", null);
1409
1455
  }
1410
- trigger.ondragstart = trigger.onselectstart = null;
1411
- _setStyle(trigger, "userSelect", "text");
1412
- _setStyle(trigger, "touchCallout", "default");
1413
- _setStyle(trigger, "MSTouchAction", "auto");
1414
- _removeListener(trigger, "mousedown", onPress);
1415
- _removeListener(trigger, "touchstart", onPress);
1416
- _removeListener(trigger, "click", onClick);
1417
- if (touchEventTarget) {
1418
- _removeListener(touchEventTarget, "touchcancel", onRelease);
1419
- _removeListener(touchEventTarget, "touchend", onRelease);
1420
- _removeListener(touchEventTarget, "touchmove", onMove);
1456
+ if (type !== "soft") {
1457
+ trigger.ondragstart = trigger.onselectstart = null;
1458
+ _setStyle(trigger, "userSelect", "text");
1459
+ _setStyle(trigger, "touchCallout", "default");
1460
+ _setStyle(trigger, "MSTouchAction", "auto");
1461
+ _removeListener(trigger, "mousedown", onPress);
1462
+ _removeListener(trigger, "touchstart", onPress);
1463
+ _removeListener(trigger, "click", onClick);
1464
+ if (touchEventTarget) {
1465
+ _removeListener(touchEventTarget, "touchcancel", onRelease);
1466
+ _removeListener(touchEventTarget, "touchend", onRelease);
1467
+ _removeListener(touchEventTarget, "touchmove", onMove);
1468
+ }
1469
+ _removeListener(_doc, "mouseup", onRelease);
1470
+ _removeListener(_doc, "mousemove", onMove);
1421
1471
  }
1422
- _removeListener(_doc, "mouseup", onRelease);
1423
- _removeListener(_doc, "mousemove", onMove);
1424
- if (ThrowPropsPlugin) {
1472
+ enabled = false;
1473
+ if (ThrowPropsPlugin && type !== "soft") {
1425
1474
  ThrowPropsPlugin.untrack(scrollProxy || target, (xyMode ? "x,y" : rotationMode ? "rotation" : "top,left"));
1426
1475
  }
1427
1476
  if (scrollProxy) {
@@ -1435,6 +1484,10 @@
1435
1484
  return self;
1436
1485
  };
1437
1486
 
1487
+ this.enabled = function(value, type) {
1488
+ return arguments.length ? (value ? this.enable(type) : this.disable(type)) : enabled;
1489
+ };
1490
+
1438
1491
  this.kill = function() {
1439
1492
  TweenLite.killTweensOf(scrollProxy || target, true, killProps);
1440
1493
  self.disable();
@@ -1483,7 +1536,7 @@
1483
1536
  p.constructor = Draggable;
1484
1537
  p.pointerX = p.pointerY = 0;
1485
1538
  p.isDragging = p.isPressed = false;
1486
- Draggable.version = "0.10.3";
1539
+ Draggable.version = "0.10.4";
1487
1540
  Draggable.zIndex = 1000;
1488
1541
 
1489
1542
  _addListener(_doc, "touchcancel", function() {
@@ -1523,9 +1576,8 @@
1523
1576
  if (r.right === undefined && r.width !== undefined) {
1524
1577
  r.right = r.left + r.width;
1525
1578
  r.bottom = r.top + r.height;
1526
- } else if (!r.width) { //some browsers don't include width and height properties
1527
- r.width = r.right - r.left;
1528
- r.height = r.bottom - r.top;
1579
+ } else if (r.width === undefined) { //some browsers don't include width and height properties. We can't just set them directly on r because some browsers throw errors, so create a new generic object.
1580
+ r = {width: r.right - r.left, height: r.bottom - r.top, right: r.right, left: r.left, bottom: r.bottom, top: r.top};
1529
1581
  }
1530
1582
  return r;
1531
1583
  };