greensock-rails 1.19.0.0 → 1.19.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/greensock/rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/greensock/TimelineLite.js +9 -9
  5. data/vendor/assets/javascripts/greensock/TimelineMax.js +25 -16
  6. data/vendor/assets/javascripts/greensock/TweenLite.js +28 -24
  7. data/vendor/assets/javascripts/greensock/TweenMax.js +139 -82
  8. data/vendor/assets/javascripts/greensock/easing/EasePack.js +2 -2
  9. data/vendor/assets/javascripts/greensock/jquery.gsap.js +2 -2
  10. data/vendor/assets/javascripts/greensock/plugins/AttrPlugin.js +17 -3
  11. data/vendor/assets/javascripts/greensock/plugins/BezierPlugin.js +3 -3
  12. data/vendor/assets/javascripts/greensock/plugins/CSSPlugin.js +91 -47
  13. data/vendor/assets/javascripts/greensock/plugins/CSSRulePlugin.js +3 -3
  14. data/vendor/assets/javascripts/greensock/plugins/ColorPropsPlugin.js +16 -2
  15. data/vendor/assets/javascripts/greensock/plugins/DirectionalRotationPlugin.js +17 -3
  16. data/vendor/assets/javascripts/greensock/plugins/EaselPlugin.js +27 -7
  17. data/vendor/assets/javascripts/greensock/plugins/EndArrayPlugin.js +2 -2
  18. data/vendor/assets/javascripts/greensock/plugins/ModifiersPlugin.js +18 -4
  19. data/vendor/assets/javascripts/greensock/plugins/RaphaelPlugin.js +2 -2
  20. data/vendor/assets/javascripts/greensock/plugins/RoundPropsPlugin.js +2 -2
  21. data/vendor/assets/javascripts/greensock/plugins/ScrollToPlugin.js +6 -5
  22. data/vendor/assets/javascripts/greensock/plugins/TEMPLATE_Plugin.js +2 -2
  23. data/vendor/assets/javascripts/greensock/plugins/TextPlugin.js +17 -3
  24. data/vendor/assets/javascripts/greensock/utils/Draggable.js +170 -52
  25. metadata +17 -17
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * VERSION: 0.2.0
3
- * DATE: 2016-07-12
2
+ * VERSION: 0.2.1
3
+ * DATE: 2017-01-17
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
- * @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
6
+ * @license Copyright (c) 2008-2017, GreenSock. All rights reserved.
7
7
  * This work is subject to the terms at http://greensock.com/standard-license or for
8
8
  * Club GreenSock members, the software agreement that was issued with your membership.
9
9
  *
@@ -229,13 +229,13 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
229
229
  _gsScope._gsDefine.plugin({
230
230
  propName: "easel",
231
231
  priority: -1,
232
- version: "0.2.0",
232
+ version: "0.2.1",
233
233
  API: 2,
234
234
 
235
235
  //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
236
236
  init: function(target, value, tween, index) {
237
237
  this._target = target;
238
- var p, pt, tint, colorMatrix, end;
238
+ var p, pt, tint, colorMatrix, end, labels, i;
239
239
  for (p in value) {
240
240
 
241
241
  end = value[p];
@@ -256,7 +256,14 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
256
256
 
257
257
  } else if (p === "frame") {
258
258
  this._firstPT = pt = {_next:this._firstPT, t:target, p:"gotoAndStop", s:target.currentFrame, f:true, n:"frame", pr:0, type:0, m:Math.round};
259
- pt.c = (typeof(end) === "number") ? end - pt.s : (typeof(end) === "string") ? parseFloat(end.split("=").join("")) : 0;
259
+ if (typeof(end) === "string" && end.charAt(1) !== "=" && (labels = target.labels)) {
260
+ for (i = 0; i < labels.length; i++) {
261
+ if (labels[i].label === end) {
262
+ end = labels[i].position;
263
+ }
264
+ }
265
+ }
266
+ pt.c = (typeof(end) === "number") ? end - pt.s : parseFloat((end+"").split("=").join(""));
260
267
  if (pt._next) {
261
268
  pt._next._prev = pt;
262
269
  }
@@ -301,4 +308,17 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
301
308
 
302
309
  });
303
310
 
304
- }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
311
+ }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
312
+ //export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date)
313
+ (function(name) {
314
+ "use strict";
315
+ var getGlobal = function() {
316
+ return (_gsScope.GreenSockGlobals || _gsScope)[name];
317
+ };
318
+ if (typeof(define) === "function" && define.amd) { //AMD
319
+ define(["TweenLite"], getGlobal);
320
+ } else if (typeof(module) !== "undefined" && module.exports) { //node
321
+ require("../TweenLite.js");
322
+ module.exports = getGlobal();
323
+ }
324
+ }("EaselPlugin"));
@@ -1,9 +1,9 @@
1
1
  /*!
2
2
  * VERSION: 0.1.3
3
- * DATE: 2016-07-12
3
+ * DATE: 2017-01-17
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
- * @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
6
+ * @license Copyright (c) 2008-2017, GreenSock. All rights reserved.
7
7
  * This work is subject to the terms at http://greensock.com/standard-license or for
8
8
  * Club GreenSock members, the software agreement that was issued with your membership.
9
9
  *
@@ -1,9 +1,9 @@
1
1
  /*!
2
2
  * VERSION: 0.0.2
3
- * DATE: 2016-07-14
3
+ * DATE: 2017-01-17
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
- * @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
6
+ * @license Copyright (c) 2008-2017, GreenSock. All rights reserved.
7
7
  * This work is subject to the terms at http://greensock.com/standard-license or for
8
8
  * Club GreenSock members, the software agreement that was issued with your membership.
9
9
  *
@@ -150,9 +150,23 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
150
150
  };
151
151
 
152
152
  p = _gsScope._gsDefine.globals.TweenLite.version.split(".");
153
- if (Number(p[0]) <= 1 && Number(p[1]) < 19 && window.console) {
153
+ if (Number(p[0]) <= 1 && Number(p[1]) < 19 && _gsScope.console) {
154
154
  console.log("ModifiersPlugin requires GSAP 1.19.0 or later.");
155
155
  }
156
156
 
157
157
 
158
- }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
158
+ }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
159
+
160
+ //export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date)
161
+ (function(name) {
162
+ "use strict";
163
+ var getGlobal = function() {
164
+ return (_gsScope.GreenSockGlobals || _gsScope)[name];
165
+ };
166
+ if (typeof(define) === "function" && define.amd) { //AMD
167
+ define(["TweenLite"], getGlobal);
168
+ } else if (typeof(module) !== "undefined" && module.exports) { //node
169
+ require("../TweenLite.js");
170
+ module.exports = getGlobal();
171
+ }
172
+ }("ModifiersPlugin"));
@@ -1,9 +1,9 @@
1
1
  /*!
2
2
  * VERSION: 0.2.2
3
- * DATE: 2014-07-17
3
+ * DATE: 2017-01-17
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
- * @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
6
+ * @license Copyright (c) 2008-2017, GreenSock. All rights reserved.
7
7
  * This work is subject to the terms at http://greensock.com/standard-license or for
8
8
  * Club GreenSock members, the software agreement that was issued with your membership.
9
9
  *
@@ -1,9 +1,9 @@
1
1
  /*!
2
2
  * VERSION: 1.6.0
3
- * DATE: 2015-07-16
3
+ * DATE: 2017-01-17
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
- * @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
6
+ * @license Copyright (c) 2008-2017, GreenSock. All rights reserved.
7
7
  * This work is subject to the terms at http://greensock.com/standard-license or for
8
8
  * Club GreenSock members, the software agreement that was issued with your membership.
9
9
  *
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * VERSION: 1.8.0
3
- * DATE: 2016-07-09
2
+ * VERSION: 1.8.1
3
+ * DATE: 2017-01-17
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
- * @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
6
+ * @license Copyright (c) 2008-2017, GreenSock. All rights reserved.
7
7
  * This work is subject to the terms at http://greensock.com/standard-license or for
8
8
  * Club GreenSock members, the software agreement that was issued with your membership.
9
9
  *
@@ -15,7 +15,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
15
15
  "use strict";
16
16
 
17
17
  var _doc = document.documentElement,
18
- _window = window,
18
+ _window = _gsScope,
19
19
  _max = function(element, axis) {
20
20
  var dim = (axis === "x") ? "Width" : "Height",
21
21
  scroll = "scroll" + dim,
@@ -71,7 +71,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
71
71
  ScrollToPlugin = _gsScope._gsDefine.plugin({
72
72
  propName: "scrollTo",
73
73
  API: 2,
74
- version:"1.8.0",
74
+ global: true,
75
+ version:"1.8.1",
75
76
 
76
77
  //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
77
78
  init: function(target, value, tween) {
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * VERSION: 1.2.0
3
- * DATE: 2016-07-14
3
+ * DATE: 2017-01-17
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
6
  * This file is to be used as a simple template for writing your own plugin. See the
@@ -10,7 +10,7 @@
10
10
  * of your property is. This way of defining a plugin was introduced in version 1.9.0 - previous versions
11
11
  * of TweenLite won't work with this.
12
12
  *
13
- * @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
13
+ * @license Copyright (c) 2008-2017, GreenSock. All rights reserved.
14
14
  * This work is subject to the terms at http://greensock.com/standard-license or for
15
15
  * Club GreenSock members, the software agreement that was issued with your membership.
16
16
  *
@@ -1,9 +1,9 @@
1
1
  /*!
2
2
  * VERSION: 0.5.2
3
- * DATE: 2016-06-22
3
+ * DATE: 2017-01-17
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
- * @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
6
+ * @license Copyright (c) 2008-2017, GreenSock. All rights reserved.
7
7
  * This work is subject to the terms at http://greensock.com/standard-license or for
8
8
  * Club GreenSock members, the software agreement that was issued with your membership.
9
9
  *
@@ -115,4 +115,18 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
115
115
 
116
116
  p._newClass = p._oldClass = p._delimiter = "";
117
117
 
118
- }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
118
+ }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
119
+
120
+ //export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date)
121
+ (function(name) {
122
+ "use strict";
123
+ var getGlobal = function() {
124
+ return (_gsScope.GreenSockGlobals || _gsScope)[name];
125
+ };
126
+ if (typeof(define) === "function" && define.amd) { //AMD
127
+ define(["TweenLite"], getGlobal);
128
+ } else if (typeof(module) !== "undefined" && module.exports) { //node
129
+ require("../TweenLite.js");
130
+ module.exports = getGlobal();
131
+ }
132
+ }("TextPlugin"));
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VERSION: 0.14.8
3
- * DATE: 2016-07-18
2
+ * VERSION: 0.15.0
3
+ * DATE: 2017-01-17
4
4
  * UPDATES AND DOCS AT: http://greensock.com
5
5
  *
6
6
  * Requires TweenLite and CSSPlugin version 1.17.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://greensock.com/club/).
7
7
  *
8
- * @license Copyright (c) 2008-2016, GreenSock. All rights reserved.
8
+ * @license Copyright (c) 2008-2017, GreenSock. All rights reserved.
9
9
  * This work is subject to the terms at http://greensock.com/standard-license or for
10
10
  * Club GreenSock members, the software agreement that was issued with your membership.
11
11
  *
@@ -24,7 +24,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
24
24
  _tempVarsRotation = {css:{}},
25
25
  _globals = _gsScope._gsDefine.globals,
26
26
  _tempEvent = {}, //for populating with pageX/pageY in old versions of IE
27
- _doc = document,
27
+ _dummyElement = {style:{}},
28
+ _doc = _gsScope.document || {createElement: function() {return _dummyElement;}},
28
29
  _docElement = _doc.documentElement || {},
29
30
  _createElement = function(type) {
30
31
  return _doc.createElementNS ? _doc.createElementNS("http://www.w3.org/1999/xhtml", type) : _doc.createElement(type);
@@ -61,10 +62,16 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
61
62
  for (i = 0; i !== l; b.push(a[i++]));
62
63
  return b;
63
64
  },
64
- _copy = function(obj) {
65
+ _copy = function(obj, factor) {
65
66
  var copy = {}, p;
66
- for (p in obj) {
67
- copy[p] = obj[p];
67
+ if (factor) {
68
+ for (p in obj) {
69
+ copy[p] = obj[p] * factor;
70
+ }
71
+ } else {
72
+ for (p in obj) {
73
+ copy[p] = obj[p];
74
+ }
68
75
  }
69
76
  return copy;
70
77
  },
@@ -381,8 +388,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
381
388
  if (!e.getBoundingClientRect || !e.parentNode || !_transformProp) {
382
389
  return {offsetTop:0, offsetLeft:0, scaleX:1, scaleY:1, offsetParent:_docElement};
383
390
  }
384
- if (Draggable.cacheSVGData !== false && e._gsCache && e._gsCache.lastUpdate === TweenLite.ticker.frame) { //performance optimization. Assume that if the offsets are requested again on the same tick, we can just feed back the values we already calculated (no need to keep recalculating until another tick elapses).
385
- return e._gsCache;
391
+ if (Draggable.cacheSVGData !== false && e._dCache && e._dCache.lastUpdate === TweenLite.ticker.frame) { //performance optimization. Assume that if the offsets are requested again on the same tick, we can just feed back the values we already calculated (no need to keep recalculating until another tick elapses).
392
+ return e._dCache;
386
393
  }
387
394
  var curElement = e,
388
395
  cache = _cache(e),
@@ -493,11 +500,11 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
493
500
  }
494
501
  return decoratee;
495
502
  },
496
- _cache = function(e) { //computes some important values and stores them in a _gsCache object attached to the element itself so that we can optimize performance
497
- if (Draggable.cacheSVGData !== false && e._gsCache && e._gsCache.lastUpdate === TweenLite.ticker.frame) { //performance optimization. Assume that if the offsets are requested again on the same tick, we can just feed back the values we already calculated (no need to keep recalculating until another tick elapses).
498
- return e._gsCache;
503
+ _cache = function(e) { //computes some important values and stores them in a _dCache object attached to the element itself so that we can optimize performance
504
+ if (Draggable.cacheSVGData !== false && e._dCache && e._dCache.lastUpdate === TweenLite.ticker.frame) { //performance optimization. Assume that if the offsets are requested again on the same tick, we can just feed back the values we already calculated (no need to keep recalculating until another tick elapses).
505
+ return e._dCache;
499
506
  }
500
- var cache = e._gsCache = e._gsCache || {},
507
+ var cache = e._dCache = e._dCache || {},
501
508
  cs = _getComputedStyle(e),
502
509
  isSVG = (e.getBBox && _isSVG(e)),
503
510
  isSVGRoot = ((e.nodeName + "").toLowerCase() === "svg"),
@@ -526,14 +533,13 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
526
533
  if (e === window || !e || !e.style || !e.parentNode) {
527
534
  return [1,0,0,1,0,0];
528
535
  }
529
- var cache = e._gsCache || _cache(e),
536
+ var cache = e._dCache || _cache(e),
530
537
  parent = e.parentNode,
531
- parentCache = parent._gsCache || _cache(parent),
538
+ parentCache = parent._dCache || _cache(parent),
532
539
  cs = cache.computedStyle,
533
540
  parentOffsetParent = cache.isSVG ? parentCache.offsetParent : parent.offsetParent,
534
541
  m, isRoot, offsets, rect, t, sx, sy, offsetX, offsetY, parentRect, borderTop, borderLeft, borderTranslateX, borderTranslateY;
535
542
  m = (cache.isSVG && (e.style[_transformProp] + "").indexOf("matrix") !== -1) ? e.style[_transformProp] : cs ? cs.getPropertyValue(_transformPropCSS) : e.currentStyle ? e.currentStyle[_transformProp] : "1,0,0,1,0,0"; //some browsers (like Chrome 40) don't correctly report transforms that are applied inline on an SVG element (they don't get included in the computed style), so we double-check here and accept matrix values
536
-
537
543
  if (e.getBBox && (e.getAttribute("transform") + "").indexOf("matrix") !== -1) { //SVG can store transform data in its "transform" attribute instead of the CSS, so look for that here (only accept matrix()).
538
544
  m = e.getAttribute("transform");
539
545
  }
@@ -827,14 +833,29 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
827
833
  if (factor !== 1 && snap instanceof Array) { //some data must be altered to make sense, like if the user passes in an array of rotational values in degrees, we must convert it to radians. Or for scrollLeft and scrollTop, we invert the values.
828
834
  vars.end = a = [];
829
835
  l = snap.length;
830
- for (i = 0; i < l; i++) {
831
- a[i] = snap[i] * factor;
836
+ if (typeof(snap[0]) === "object") { //if the array is populated with objects, like points ({x:100, y:200}), make copies before multiplying by the factor, otherwise we'll mess up the originals and the user may reuse it elsewhere.
837
+ for (i = 0; i < l; i++) {
838
+ a[i] = _copy(snap[i], factor);
839
+ }
840
+ } else {
841
+ for (i = 0; i < l; i++) {
842
+ a[i] = snap[i] * factor;
843
+ }
832
844
  }
833
845
  max += 1.1; //allow 1.1 pixels of wiggle room when snapping in order to work around some browser inconsistencies in the way bounds are reported which can make them roughly a pixel off. For example, if "snap:[-$('#menu').width(), 0]" was defined and #menu had a wrapper that was used as the bounds, some browsers would be one pixel off, making the minimum -752 for example when snap was [-753,0], thus instead of snapping to -753, it would snap to 0 since -753 was below the minimum.
834
846
  min -= 1.1;
835
847
  } else if (typeof(snap) === "function") {
836
848
  vars.end = function(value) {
837
- return snap.call(draggable, value) * factor; //we need to ensure that we can scope the function call to the Draggable instance itself so that users can access important values like maxX, minX, maxY, minY, x, and y from within that function.
849
+ var result = snap.call(draggable, value),
850
+ copy, p;
851
+ if (factor !== 1 && typeof(result) === "object") {
852
+ copy = {};
853
+ for (p in result) {
854
+ copy[p] = result[p] * factor;
855
+ }
856
+ result = copy;
857
+ }
858
+ return result; //we need to ensure that we can scope the function call to the Draggable instance itself so that users can access important values like maxX, minX, maxY, minY, x, and y from within that function.
838
859
  };
839
860
  } else {
840
861
  vars.end = snap;
@@ -1139,7 +1160,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1139
1160
  checkAutoScrollBounds = false,
1140
1161
  isClickable = vars.clickableTest || _isClickable,
1141
1162
  clickTime = 0,
1142
- enabled, scrollProxy, startPointerX, startPointerY, startElementX, startElementY, hasBounds, hasDragCallback, maxX, minX, maxY, minY, tempVars, cssVars, touch, touchID, rotationOrigin, dirty, old, snapX, snapY, isClicking, touchEventTarget, matrix, interrupted, startScrollTop, startScrollLeft, applyObj, allowNativeTouchScrolling, touchDragAxis, isDispatching, clickDispatch, trustedClickDispatch,
1163
+ enabled, scrollProxy, startPointerX, startPointerY, startElementX, startElementY, hasBounds, hasDragCallback, maxX, minX, maxY, minY, tempVars, cssVars, touch, touchID, rotationOrigin, dirty, old, snapX, snapY, snapXY, isClicking, touchEventTarget, matrix, interrupted, startScrollTop, startScrollLeft, applyObj, allowNativeTouchScrolling, touchDragAxis, isDispatching, clickDispatch, trustedClickDispatch,
1164
+
1143
1165
  //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.
1144
1166
  render = function(suppressEvents) {
1145
1167
  if (self.autoScroll && self.isDragging && (checkAutoScrollBounds || dirty)) {
@@ -1205,29 +1227,36 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1205
1227
  y = 0;
1206
1228
  }
1207
1229
  if (rotationMode) {
1230
+ self.deltaX = x - applyObj.data.rotation;
1208
1231
  applyObj.data.rotation = self.rotation = x;
1209
1232
  applyObj.setRatio(1); //note: instead of doing TweenLite.set(), as a performance optimization we skip right to the method that renders the transforms inside CSSPlugin. For old versions of IE, though, we do a normal TweenLite.set() to leverage its ability to re-reroute to an IE-specific 2D renderer.
1210
1233
  } else {
1211
1234
  if (scrollProxy) {
1212
1235
  if (allowY) {
1236
+ self.deltaY = y - scrollProxy.top();
1213
1237
  scrollProxy.top(y);
1214
1238
  }
1215
1239
  if (allowX) {
1240
+ self.deltaX = x - scrollProxy.left();
1216
1241
  scrollProxy.left(x);
1217
1242
  }
1218
1243
  } else if (xyMode) {
1219
1244
  if (allowY) {
1245
+ self.deltaY = y - applyObj.data.y;
1220
1246
  applyObj.data.y = y;
1221
1247
  }
1222
1248
  if (allowX) {
1249
+ self.deltaX = x - applyObj.data.x;
1223
1250
  applyObj.data.x = x;
1224
1251
  }
1225
1252
  applyObj.setRatio(1); //note: instead of doing TweenLite.set(), as a performance optimization we skip right to the method that renders the transforms inside CSSPlugin. For old versions of IE, though, we do a normal TweenLite.set() to leverage its ability to re-reroute to an IE-specific 2D renderer.
1226
1253
  } else {
1227
1254
  if (allowY) {
1255
+ self.deltaY = y - parseFloat(target.style.top || 0);
1228
1256
  target.style.top = y + "px";
1229
1257
  }
1230
1258
  if (allowX) {
1259
+ self.deltaY = x - parseFloat(target.style.left || 0);
1231
1260
  target.style.left = x + "px";
1232
1261
  }
1233
1262
  }
@@ -1261,7 +1290,20 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1261
1290
  self.y = parseInt(target.style.top, 10) || 0;
1262
1291
  self.x = parseInt(target.style.left, 10) || 0;
1263
1292
  }
1264
- if ((snapX || snapY) && !skipSnap) {
1293
+ if ((snapX || snapY || snapXY) && !skipSnap && (self.isDragging || self.isThrowing)) {
1294
+ if (snapXY) {
1295
+ _temp1.x = self.x;
1296
+ _temp1.y = self.y;
1297
+ snappedValue = snapXY(_temp1);
1298
+ if (snappedValue.x !== self.x) {
1299
+ self.x = snappedValue.x;
1300
+ dirty = true;
1301
+ }
1302
+ if (snappedValue.y !== self.y) {
1303
+ self.y = snappedValue.y;
1304
+ dirty = true;
1305
+ }
1306
+ }
1265
1307
  if (snapX) {
1266
1308
  snappedValue = snapX(self.x);
1267
1309
  if (snappedValue !== self.x) {
@@ -1284,6 +1326,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1284
1326
  render(true);
1285
1327
  }
1286
1328
  if (!skipOnUpdate) {
1329
+ self.deltaX = self.x - x;
1330
+ self.deltaY = self.y - y;
1287
1331
  _dispatchEvent(self, "throwupdate", "onThrowUpdate");
1288
1332
  }
1289
1333
  },
@@ -1339,11 +1383,15 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1339
1383
  snapX = buildSnapFunc((snapIsRaw ? snap : snap.rotation), minX, maxX, 1);
1340
1384
  snapY = null;
1341
1385
  } else {
1342
- if (allowX) {
1343
- snapX = buildSnapFunc((snapIsRaw ? snap : snap.x || snap.left || snap.scrollLeft), minX, maxX, scrollProxy ? -1 : 1);
1344
- }
1345
- if (allowY) {
1346
- snapY = buildSnapFunc((snapIsRaw ? snap : snap.y || snap.top || snap.scrollTop), minY, maxY, scrollProxy ? -1 : 1);
1386
+ if (snap.points) {
1387
+ snapXY = buildPointSnapFunc((snapIsRaw ? snap : snap.points), minX, maxX, minY, maxY, snap.radius, scrollProxy ? -1 : 1);
1388
+ } else {
1389
+ if (allowX) {
1390
+ snapX = buildSnapFunc((snapIsRaw ? snap : snap.x || snap.left || snap.scrollLeft), minX, maxX, scrollProxy ? -1 : 1);
1391
+ }
1392
+ if (allowY) {
1393
+ snapY = buildSnapFunc((snapIsRaw ? snap : snap.y || snap.top || snap.scrollTop), minY, maxY, scrollProxy ? -1 : 1);
1394
+ }
1347
1395
  }
1348
1396
  }
1349
1397
  }
@@ -1362,23 +1410,27 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1362
1410
  var snap, snapIsRaw, tween, overshootTolerance;
1363
1411
  if (throwProps && ThrowPropsPlugin) {
1364
1412
  if (throwProps === true) {
1365
- snap = vars.snap || {};
1413
+ snap = vars.snap || vars.liveSnap || {};
1366
1414
  snapIsRaw = (snap instanceof Array || typeof(snap) === "function");
1367
1415
  throwProps = {resistance:(vars.throwResistance || vars.resistance || 1000) / (rotationMode ? 10 : 1)};
1368
1416
  if (rotationMode) {
1369
1417
  throwProps.rotation = _parseThrowProps(self, snapIsRaw ? snap : snap.rotation, maxX, minX, 1, forceZeroVelocity);
1370
1418
  } else {
1371
1419
  if (allowX) {
1372
- throwProps[xProp] = _parseThrowProps(self, snapIsRaw ? snap : snap.x || snap.left || snap.scrollLeft, maxX, minX, scrollProxy ? -1 : 1, forceZeroVelocity || (self.lockedAxis === "x"));
1420
+ throwProps[xProp] = _parseThrowProps(self, snapIsRaw ? snap : snap.points || snap.x || snap.left || snap.scrollLeft, maxX, minX, scrollProxy ? -1 : 1, forceZeroVelocity || (self.lockedAxis === "x"));
1373
1421
  }
1374
1422
  if (allowY) {
1375
- throwProps[yProp] = _parseThrowProps(self, snapIsRaw ? snap : snap.y || snap.top || snap.scrollTop, maxY, minY, scrollProxy ? -1 : 1, forceZeroVelocity || (self.lockedAxis === "y"));
1423
+ throwProps[yProp] = _parseThrowProps(self, snapIsRaw ? snap : snap.points || snap.y || snap.top || snap.scrollTop, maxY, minY, scrollProxy ? -1 : 1, forceZeroVelocity || (self.lockedAxis === "y"));
1424
+ }
1425
+ if (snap.points || (snap instanceof Array && typeof(snap[0]) === "object")) {
1426
+ throwProps.linkedProps = xProp + "," + yProp;
1427
+ throwProps.radius = snap.radius; //note: we also disable liveSnapping while throwing if there's a "radius" defined, otherwise it looks weird to have the item thrown past a snapping point but live-snapping mid-tween. We do this by altering the onUpdateParams so that "skipSnap" parameter is true for syncXY.
1376
1428
  }
1377
1429
  }
1378
1430
  }
1379
1431
  self.isThrowing = true;
1380
1432
  overshootTolerance = (!isNaN(vars.overshootTolerance)) ? vars.overshootTolerance : (vars.edgeResistance === 1) ? 0 : (1 - self.edgeResistance) + 0.2;
1381
- self.tween = tween = ThrowPropsPlugin.to(scrollProxy || target, {throwProps:throwProps, ease:(vars.ease || _globals.Power3.easeOut), onComplete:onThrowComplete, onOverwrite:onThrowOverwrite, onUpdate:(vars.fastMode ? _dispatchEvent : syncXY), onUpdateParams:(vars.fastMode ? [self, "onthrowupdate", "onThrowUpdate"] : _emptyArray)}, (isNaN(vars.maxDuration) ? 2 : vars.maxDuration), (!isNaN(vars.minDuration) ? vars.minDuration : (overshootTolerance === 0) ? 0 : 0.5), overshootTolerance);
1433
+ self.tween = tween = ThrowPropsPlugin.to(scrollProxy || target, {throwProps:throwProps, ease:(vars.ease || _globals.Power3.easeOut), onComplete:onThrowComplete, onOverwrite:onThrowOverwrite, onUpdate:(vars.fastMode ? _dispatchEvent : syncXY), onUpdateParams:(vars.fastMode ? [self, "onthrowupdate", "onThrowUpdate"] : (snap && snap.radius) ? [false, true] : _emptyArray)}, (isNaN(vars.maxDuration) ? 2 : vars.maxDuration), (!isNaN(vars.minDuration) ? vars.minDuration : (overshootTolerance === 0) ? 0 : 0.5), overshootTolerance);
1382
1434
  if (!vars.fastMode) {
1383
1435
  //to populate the end values, we just scrub the tween to the end, record the values, and then jump back to the beginning.
1384
1436
  if (scrollProxy) {
@@ -1474,6 +1526,8 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1474
1526
  }
1475
1527
  }
1476
1528
  }
1529
+ self.startX = startElementX;
1530
+ self.startY = startElementY;
1477
1531
  },
1478
1532
 
1479
1533
  isTweening = function() {
@@ -1516,6 +1570,58 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1516
1570
  return isNaN(snap) ? function(n) { return n; } : function() { return snap * factor; };
1517
1571
  },
1518
1572
 
1573
+ buildPointSnapFunc = function(snap, minX, maxX, minY, maxY, radius, factor) {
1574
+ radius = radius || _max;
1575
+ if (typeof(snap) === "function") {
1576
+ return function(point) {
1577
+ var edgeTolerance = !self.isPressed ? 1 : 1 - self.edgeResistance,
1578
+ x = point.x,
1579
+ y = point.y,
1580
+ result, dx, dy; //if we're tweening, disable the edgeTolerance because it's already factored into the tweening values (we don't want to apply it multiple times)
1581
+ point.x = x = (x > maxX ? maxX + (x - maxX) * edgeTolerance : (x < minX) ? minX + (x - minX) * edgeTolerance : x);
1582
+ point.y = y = (y > maxY ? maxY + (y - maxY) * edgeTolerance : (y < minY) ? minY + (y - minY) * edgeTolerance : y);
1583
+ result = snap.call(self, point);
1584
+ if (result !== point) {
1585
+ point.x = result.x;
1586
+ point.y = result.y;
1587
+ }
1588
+ if (factor !== 1) {
1589
+ point.x *= factor;
1590
+ point.y *= factor;
1591
+ }
1592
+ if (radius < _max) {
1593
+ dx = point.x - x;
1594
+ dy = point.y - y;
1595
+ if (Math.sqrt(dx * dx + dy * dy) > radius) {
1596
+ point.x = x;
1597
+ point.y = y;
1598
+ }
1599
+ }
1600
+ return point;
1601
+ };
1602
+ }
1603
+ if (snap instanceof Array) {
1604
+ return function(p) {
1605
+ var i = snap.length,
1606
+ closest = 0,
1607
+ minDist = _max,
1608
+ x, y, point, dist;
1609
+ while (--i > -1) {
1610
+ point = snap[i];
1611
+ x = point.x - p.x;
1612
+ y = point.y - p.y;
1613
+ dist = Math.sqrt(x * x + y * y);
1614
+ if (dist < minDist) {
1615
+ closest = i;
1616
+ minDist = dist;
1617
+ }
1618
+ }
1619
+ return (minDist <= radius) ? snap[closest] : p;
1620
+ };
1621
+ }
1622
+ return function(n) { return n; };
1623
+ },
1624
+
1519
1625
  //called when the mouse is pressed (or touch starts)
1520
1626
  onPress = function(e) {
1521
1627
  var i;
@@ -1546,7 +1652,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1546
1652
  _setSelectable(triggers, true); //accommodates things like inputs and elements with contentEditable="true" (otherwise user couldn't drag to select text)
1547
1653
  return;
1548
1654
  }
1549
- allowNativeTouchScrolling = (!touchEventTarget || allowX === allowY || scrollProxy || self.vars.allowNativeTouchScrolling === false) ? false : allowX ? "y" : "x";
1655
+ allowNativeTouchScrolling = (!touchEventTarget || allowX === allowY || self.vars.allowNativeTouchScrolling === false) ? false : allowX ? "y" : "x";
1550
1656
  if (_isOldIE) {
1551
1657
  e = _populateIEEvent(e, true);
1552
1658
  } else if (!allowNativeTouchScrolling && !self.allowEventDefault) {
@@ -1601,7 +1707,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1601
1707
  //called every time the mouse/touch moves
1602
1708
  onMove = function(e) {
1603
1709
  var originalEvent = e,
1604
- touches, pointerX, pointerY, i;
1710
+ touches, pointerX, pointerY, i, dx, dy;
1605
1711
  if (!enabled || _isMultiTouching || !self.isPressed || !e) {
1606
1712
  return;
1607
1713
  }
@@ -1630,16 +1736,20 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1630
1736
  pointerY = pointerX * matrix[1] + pointerY * matrix[3] + matrix[5];
1631
1737
  pointerX = i;
1632
1738
  }
1633
- touchDragAxis = (Math.abs(pointerX - startPointerX) > Math.abs(pointerY - startPointerY) && allowX) ? "x" : "y";
1634
- if (self.vars.lockAxisOnTouchScroll !== false) {
1635
- self.lockedAxis = (touchDragAxis === "x") ? "y" : "x";
1636
- if (typeof(self.vars.onLockAxis) === "function") {
1637
- self.vars.onLockAxis.call(self, originalEvent);
1739
+ dx = Math.abs(pointerX - startPointerX);
1740
+ dy = Math.abs(pointerY - startPointerY);
1741
+ if ((dx !== dy && (dx > minimumMovement || dy > minimumMovement)) || (_isAndroid && allowNativeTouchScrolling === touchDragAxis)) {
1742
+ touchDragAxis = (dx > dy && allowX) ? "x" : "y";
1743
+ if (self.vars.lockAxisOnTouchScroll !== false) {
1744
+ self.lockedAxis = (touchDragAxis === "x") ? "y" : "x";
1745
+ if (typeof(self.vars.onLockAxis) === "function") {
1746
+ self.vars.onLockAxis.call(self, originalEvent);
1747
+ }
1748
+ }
1749
+ if (_isAndroid && allowNativeTouchScrolling === touchDragAxis) {
1750
+ onRelease(originalEvent);
1751
+ return;
1638
1752
  }
1639
- }
1640
- if (_isAndroid && allowNativeTouchScrolling === touchDragAxis) {
1641
- onRelease(originalEvent);
1642
- return;
1643
1753
  }
1644
1754
  }
1645
1755
  if (!self.allowEventDefault && (!allowNativeTouchScrolling || (touchDragAxis && allowNativeTouchScrolling !== touchDragAxis)) && originalEvent.cancelable !== false) {
@@ -1662,7 +1772,6 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1662
1772
 
1663
1773
  self.pointerX = pointerX;
1664
1774
  self.pointerY = pointerY;
1665
-
1666
1775
  if (rotationMode) {
1667
1776
  y = Math.atan2(rotationOrigin.y - pointerY, pointerX - rotationOrigin.x) * _RAD2DEG;
1668
1777
  dif = self.y - y;
@@ -1706,7 +1815,14 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1706
1815
  y = startElementY + yChange * dragTolerance;
1707
1816
  }
1708
1817
 
1709
- if (snapX || snapY) {
1818
+ if ((snapX || snapY || snapXY) && (self.x !== x || (self.y !== y && !rotationMode))) {
1819
+ if (snapXY) {
1820
+ _temp1.x = x;
1821
+ _temp1.y = y;
1822
+ temp = snapXY(_temp1);
1823
+ x = temp.x;
1824
+ y = temp.y;
1825
+ }
1710
1826
  if (snapX) {
1711
1827
  x = snapX(x);
1712
1828
  }
@@ -1734,15 +1850,17 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1734
1850
  if (self.x !== x || (self.y !== y && !rotationMode)) {
1735
1851
  if (rotationMode) {
1736
1852
  self.endRotation = self.x = self.endX = x;
1853
+ dirty = true;
1737
1854
  } else {
1738
1855
  if (allowY) {
1739
1856
  self.y = self.endY = y;
1857
+ dirty = true; //a flag that indicates we need to render the target next time the TweenLite.ticker dispatches a "tick" event (typically on a requestAnimationFrame) - this is a performance optimization (we shouldn't render on every move because sometimes many move events can get dispatched between screen refreshes, and that'd be wasteful to render every time)
1740
1858
  }
1741
1859
  if (allowX) {
1742
1860
  self.x = self.endX = x;
1861
+ dirty = true;
1743
1862
  }
1744
1863
  }
1745
- dirty = true; //a flag that indicates we need to render the target next time the TweenLite.ticker dispatches a "tick" event (typically on a requestAnimationFrame) - this is a performance optimization (we shouldn't render on every move because sometimes many move events can get dispatched between screen refreshes, and that'd be wasteful to render every time)
1746
1864
  if (!self.isDragging && self.isPressed) {
1747
1865
  self.isDragging = true;
1748
1866
  _dispatchEvent(self, "dragstart", "onDragStart");
@@ -1834,7 +1952,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1834
1952
  }
1835
1953
  }
1836
1954
  };
1837
- if (!_isAndroid) { //iOS Safari requires the synthetic click to happen immediately or else it simply won't work, but Android doesn't play nice.
1955
+ if (!_isAndroid && !originalEvent.defaultPrevented) { //iOS Safari requires the synthetic click to happen immediately or else it simply won't work, but Android doesn't play nice.
1838
1956
  TweenLite.delayedCall(0.00001, syntheticClick); //in addition to the iOS bug workaround, there's a Firefox issue with clicking on things like a video to play, so we must fake a click event in a slightly delayed fashion. Previously, we listened for the "click" event with "capture" false which solved the video-click-to-play issue, but it would allow the "click" event to be dispatched twice like if you were using a jQuery.click() because that was handled in the capture phase, thus we had to switch to the capture phase to avoid the double-dispatching, but do the delayed synthetic click.
1839
1957
  }
1840
1958
  }
@@ -1858,7 +1976,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1858
1976
  },
1859
1977
 
1860
1978
  updateScroll = function(e) {
1861
- if (e && self.isDragging) {
1979
+ if (e && self.isDragging && !scrollProxy) {
1862
1980
  var parent = e.target || e.srcElement || target.parentNode,
1863
1981
  deltaX = parent.scrollLeft - parent._gsScrollX,
1864
1982
  deltaY = parent.scrollTop - parent._gsScrollY;
@@ -1883,12 +2001,13 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1883
2001
  recentlyDragged = (time - dragEndTime < 40),
1884
2002
  alreadyDispatched = (recentlyClicked && clickDispatch === clickTime),
1885
2003
  isModern = !!e.preventDefault,
2004
+ defaultPrevented = (self.pointerEvent && self.pointerEvent.defaultPrevented),
1886
2005
  alreadyDispatchedTrusted = (recentlyClicked && trustedClickDispatch === clickTime),
1887
2006
  trusted = e.isTrusted || (e.isTrusted == null && recentlyClicked && alreadyDispatched); //note: Safari doesn't support isTrusted, and it won't properly execute native behavior (like toggling checkboxes) on the first synthetic "click" event - we must wait for the 2nd and treat it as trusted (but stop propagation at that point). Confusing, I know. Don't you love cross-browser compatibility challenges?
1888
2007
  if (isModern && (alreadyDispatched || (recentlyDragged && self.vars.suppressClickOnDrag !== false) )) {
1889
2008
  e.stopImmediatePropagation();
1890
2009
  }
1891
- if (recentlyClicked && (!alreadyDispatched || (trusted !== alreadyDispatchedTrusted))) { //let the first click pass through unhindered. Let the next one only if it's trusted, then no more (stop quick-succession ones)
2010
+ if (recentlyClicked && !(self.pointerEvent && self.pointerEvent.defaultPrevented) && (!alreadyDispatched || (trusted !== alreadyDispatchedTrusted))) { //let the first click pass through unhindered. Let the next one only if it's trusted, then no more (stop quick-succession ones)
1892
2011
  if (trusted && alreadyDispatched) {
1893
2012
  trustedClickDispatch = clickTime;
1894
2013
  }
@@ -1898,7 +2017,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
1898
2017
  if (self.isPressed || recentlyDragged || recentlyClicked) {
1899
2018
  if (!isModern) {
1900
2019
  e.returnValue = false;
1901
- } else if (!trusted || !e.detail || !recentlyClicked) {
2020
+ } else if (!trusted || !e.detail || !recentlyClicked || defaultPrevented) {
1902
2021
  e.preventDefault();
1903
2022
  if (e.preventManipulation) {
1904
2023
  e.preventManipulation(); //for some Microsoft browsers
@@ -2059,7 +2178,7 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
2059
2178
  _setStyle(trigger, "cursor", vars.cursor || "move");
2060
2179
  }
2061
2180
  _setStyle(trigger, "touchCallout", "none");
2062
- _setStyle(trigger, "touchAction", (allowX === allowY || scrollProxy) ? "none" : allowX ? "pan-y" : "pan-x");
2181
+ _setStyle(trigger, "touchAction", (allowX === allowY) ? "none" : allowX ? "pan-y" : "pan-x");
2063
2182
  }
2064
2183
  _setSelectable(triggers, false);
2065
2184
  }
@@ -2183,9 +2302,9 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
2183
2302
  p = Draggable.prototype = new EventDispatcher();
2184
2303
 
2185
2304
  p.constructor = Draggable;
2186
- p.pointerX = p.pointerY = 0;
2305
+ p.pointerX = p.pointerY = p.startX = p.startY = p.deltaX = p.deltaY = 0;
2187
2306
  p.isDragging = p.isPressed = false;
2188
- Draggable.version = "0.14.8";
2307
+ Draggable.version = "0.15.0";
2189
2308
  Draggable.zIndex = 1000;
2190
2309
 
2191
2310
  _addListener(_doc, "touchcancel", function() {
@@ -2285,7 +2404,6 @@ var _gsScope = (typeof(module) !== "undefined" && module.exports && typeof(globa
2285
2404
 
2286
2405
  }, true);
2287
2406
 
2288
-
2289
2407
  }); if (_gsScope._gsDefine) { _gsScope._gsQueue.pop()(); }
2290
2408
 
2291
2409
  //export to AMD/RequireJS and CommonJS/Node (precursor to full modular build system coming at a later date)