greensock-rails 1.11.4.1 → 1.11.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 740e36e613fc20787d3f0a4228b478a4c9a35a78
4
- data.tar.gz: 71646bd75cabbe7d7ffeff8a0d18418c9ccc66da
3
+ metadata.gz: 8f1d652e6fc6aacf30470eb168e4291bc74b3432
4
+ data.tar.gz: 45301aef0811d86b0945577e0c9e3d1a3212ecbe
5
5
  SHA512:
6
- metadata.gz: 7e82bcabcd9227f622b8acf815ba3ded0f9aaa80507b8b9f209570d02838a3b40d6d5a68938f5633fffcd78d1268b12538f9a9b47a7e852fb2cca44f0921f42e
7
- data.tar.gz: 62d56d0f875250f50e2f945a07f65e7b3812d1468dfaa98fe946926832d1216febd59abf70993d489ed40d7b7ffc0398e826a78ab5faf8963c7ad83d5d017924
6
+ metadata.gz: a53a6d23b5a6fefa0cdec13f7b3d8541ae4d09fdbe1bf5bd10dcc134bdebc6a22d35330cf8dd9a15b6c4608b94e2f300c148dca6245a3b1d196f506ee8784de2
7
+ data.tar.gz: 462982a81bdf0dbe0470cf4248f49efac0709b8def707135d3173c229f1c8d8da5b4b6a3d8fd238f739b814451c1027af5f41ea379d8d4e9669fbb09900022bf
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This is a Ruby gem for adding the great [Greensock JavaScript tweening engine](http://www.greensock.com/gsap-js/) to Rails, so that you can animate the hell out of your RESTful app :)
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/greensock-rails.png)](http://badge.fury.io/rb/greensock-rails)
6
+
5
7
  ## greensock-rails RubyGems URL
6
8
 
7
9
  [https://rubygems.org/gems/greensock-rails](https://rubygems.org/gems/greensock-rails)
@@ -22,7 +24,7 @@ The gem is using the uncompressed GSAP files, so that you can debug your code in
22
24
 
23
25
  **To include the required GSAP files in your application, simply require them in `application.js`:**
24
26
 
25
- //= require 'greensock/TweenMax'
27
+ //= require 'greensock/TweenLite'
26
28
  //= require 'greensock/easing/EasePack'
27
29
 
28
30
  **To include the GSAP jQuery plugin in your application, use:**
@@ -31,9 +33,9 @@ The gem is using the uncompressed GSAP files, so that you can debug your code in
31
33
 
32
34
  ## Versioning
33
35
 
34
- The versioning of the gem follows the original versioning of GSAP, so:
36
+ The versioning of the gem follows the original versioning of GSAP. Minor updates to the gem will increment the minor version counter whilst maintaining the original versioning:
35
37
 
36
- `greensock-rails-1.11.4 = gsap-js-1.11.4`
38
+ `greensock-rails-1.11.4.X = gsap-js-1.11.4`
37
39
 
38
40
  ## Contributing
39
41
 
@@ -1,5 +1,5 @@
1
1
  module Greensock
2
2
  module Rails
3
- VERSION = "1.11.4.1"
3
+ VERSION = "1.11.5.0"
4
4
  end
5
5
  end
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.11.4
3
- * DATE: 2014-01-18
2
+ * VERSION: 1.11.5
3
+ * DATE: 2014-02-20
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
@@ -55,7 +55,7 @@
55
55
  _slice = _blankArray.slice,
56
56
  p = TimelineLite.prototype = new SimpleTimeline();
57
57
 
58
- TimelineLite.version = "1.11.4";
58
+ TimelineLite.version = "1.11.5";
59
59
  p.constructor = TimelineLite;
60
60
  p.kill()._gc = false;
61
61
 
@@ -177,15 +177,15 @@
177
177
 
178
178
  SimpleTimeline.prototype.add.call(this, value, position);
179
179
 
180
- //if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly.
181
- if (this._gc) if (!this._paused) if (this._duration < this.duration()) {
182
- //in case any of the anscestors had completed but should now be enabled...
180
+ //if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly. We should also align the playhead with the parent timeline's when appropriate.
181
+ if (this._gc || this._time === this._duration) if (!this._paused) if (this._duration < this.duration()) {
182
+ //in case any of the ancestors had completed but should now be enabled...
183
183
  tl = this;
184
184
  beforeRawTime = (tl.rawTime() > value._startTime); //if the tween is placed on the timeline so that it starts BEFORE the current rawTime, we should align the playhead (move the timeline). This is because sometimes users will create a timeline, let it finish, and much later append a tween and expect it to run instead of jumping to its end state. While technically one could argue that it should jump to its end state, that's not what users intuitively expect.
185
- while (tl._gc && tl._timeline) {
186
- if (tl._timeline.smoothChildTiming && beforeRawTime) {
185
+ while (tl._timeline) {
186
+ if (beforeRawTime && tl._timeline.smoothChildTiming) {
187
187
  tl.totalTime(tl._totalTime, true); //moves the timeline (shifts its startTime) if necessary, and also enables it.
188
- } else {
188
+ } else if (tl._gc) {
189
189
  tl._enabled(true, false);
190
190
  }
191
191
  tl = tl._timeline;
@@ -214,7 +214,7 @@
214
214
  SimpleTimeline.prototype._remove.call(this, tween, skipDisable);
215
215
  var last = this._last;
216
216
  if (!last) {
217
- this._time = this._totalTime = 0;
217
+ this._time = this._totalTime = this._duration = this._totalDuration = 0;
218
218
  } else if (this._time > last._startTime + last._totalDuration / last._timeScale) {
219
219
  this._time = this.duration();
220
220
  this._totalTime = this._totalDuration;
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.11.4
3
- * DATE: 2014-01-18
2
+ * VERSION: 1.11.5
3
+ * DATE: 2014-02-20
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
@@ -31,7 +31,7 @@
31
31
 
32
32
  p.constructor = TimelineMax;
33
33
  p.kill()._gc = false;
34
- TimelineMax.version = "1.11.4";
34
+ TimelineMax.version = "1.11.5";
35
35
 
36
36
  p.invalidate = function() {
37
37
  this._yoyo = (this.vars.yoyo === true);
@@ -494,7 +494,7 @@
494
494
  _slice = _blankArray.slice,
495
495
  p = TimelineLite.prototype = new SimpleTimeline();
496
496
 
497
- TimelineLite.version = "1.11.4";
497
+ TimelineLite.version = "1.11.5";
498
498
  p.constructor = TimelineLite;
499
499
  p.kill()._gc = false;
500
500
 
@@ -616,15 +616,15 @@
616
616
 
617
617
  SimpleTimeline.prototype.add.call(this, value, position);
618
618
 
619
- //if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly.
620
- if (this._gc) if (!this._paused) if (this._duration < this.duration()) {
621
- //in case any of the anscestors had completed but should now be enabled...
619
+ //if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly. We should also align the playhead with the parent timeline's when appropriate.
620
+ if (this._gc || this._time === this._duration) if (!this._paused) if (this._duration < this.duration()) {
621
+ //in case any of the ancestors had completed but should now be enabled...
622
622
  tl = this;
623
623
  beforeRawTime = (tl.rawTime() > value._startTime); //if the tween is placed on the timeline so that it starts BEFORE the current rawTime, we should align the playhead (move the timeline). This is because sometimes users will create a timeline, let it finish, and much later append a tween and expect it to run instead of jumping to its end state. While technically one could argue that it should jump to its end state, that's not what users intuitively expect.
624
- while (tl._gc && tl._timeline) {
625
- if (tl._timeline.smoothChildTiming && beforeRawTime) {
624
+ while (tl._timeline) {
625
+ if (beforeRawTime && tl._timeline.smoothChildTiming) {
626
626
  tl.totalTime(tl._totalTime, true); //moves the timeline (shifts its startTime) if necessary, and also enables it.
627
- } else {
627
+ } else if (tl._gc) {
628
628
  tl._enabled(true, false);
629
629
  }
630
630
  tl = tl._timeline;
@@ -653,7 +653,7 @@
653
653
  SimpleTimeline.prototype._remove.call(this, tween, skipDisable);
654
654
  var last = this._last;
655
655
  if (!last) {
656
- this._time = this._totalTime = 0;
656
+ this._time = this._totalTime = this._duration = this._totalDuration = 0;
657
657
  } else if (this._time > last._startTime + last._totalDuration / last._timeScale) {
658
658
  this._time = this.duration();
659
659
  this._totalTime = this._totalDuration;
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.11.4
3
- * DATE: 2014-01-18
2
+ * VERSION: 1.11.5
3
+ * DATE: 2014-02-20
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
@@ -872,7 +872,7 @@
872
872
  p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
873
873
  p._notifyPluginsOfEnabled = false;
874
874
 
875
- TweenLite.version = "1.11.4";
875
+ TweenLite.version = "1.11.5";
876
876
  TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
877
877
  TweenLite.defaultOverwrite = "auto";
878
878
  TweenLite.ticker = _ticker;
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.11.4
3
- * DATE: 2014-01-18
2
+ * VERSION: 1.11.5
3
+ * DATE: 2014-02-20
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * Includes all of the following: TweenLite, TweenMax, TimelineLite, TimelineMax, EasePack, CSSPlugin, RoundPropsPlugin, BezierPlugin, AttrPlugin, DirectionalRotationPlugin
@@ -34,7 +34,7 @@
34
34
  p = TweenMax.prototype = TweenLite.to({}, 0.1, {}),
35
35
  _blankArray = [];
36
36
 
37
- TweenMax.version = "1.11.4";
37
+ TweenMax.version = "1.11.5";
38
38
  p.constructor = TweenMax;
39
39
  p.kill()._gc = false;
40
40
  TweenMax.killTweensOf = TweenMax.killDelayedCallsTo = TweenLite.killTweensOf;
@@ -607,7 +607,7 @@
607
607
  _slice = _blankArray.slice,
608
608
  p = TimelineLite.prototype = new SimpleTimeline();
609
609
 
610
- TimelineLite.version = "1.11.4";
610
+ TimelineLite.version = "1.11.5";
611
611
  p.constructor = TimelineLite;
612
612
  p.kill()._gc = false;
613
613
 
@@ -729,15 +729,15 @@
729
729
 
730
730
  SimpleTimeline.prototype.add.call(this, value, position);
731
731
 
732
- //if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly.
733
- if (this._gc) if (!this._paused) if (this._duration < this.duration()) {
734
- //in case any of the anscestors had completed but should now be enabled...
732
+ //if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly. We should also align the playhead with the parent timeline's when appropriate.
733
+ if (this._gc || this._time === this._duration) if (!this._paused) if (this._duration < this.duration()) {
734
+ //in case any of the ancestors had completed but should now be enabled...
735
735
  tl = this;
736
736
  beforeRawTime = (tl.rawTime() > value._startTime); //if the tween is placed on the timeline so that it starts BEFORE the current rawTime, we should align the playhead (move the timeline). This is because sometimes users will create a timeline, let it finish, and much later append a tween and expect it to run instead of jumping to its end state. While technically one could argue that it should jump to its end state, that's not what users intuitively expect.
737
- while (tl._gc && tl._timeline) {
738
- if (tl._timeline.smoothChildTiming && beforeRawTime) {
737
+ while (tl._timeline) {
738
+ if (beforeRawTime && tl._timeline.smoothChildTiming) {
739
739
  tl.totalTime(tl._totalTime, true); //moves the timeline (shifts its startTime) if necessary, and also enables it.
740
- } else {
740
+ } else if (tl._gc) {
741
741
  tl._enabled(true, false);
742
742
  }
743
743
  tl = tl._timeline;
@@ -766,7 +766,7 @@
766
766
  SimpleTimeline.prototype._remove.call(this, tween, skipDisable);
767
767
  var last = this._last;
768
768
  if (!last) {
769
- this._time = this._totalTime = 0;
769
+ this._time = this._totalTime = this._duration = this._totalDuration = 0;
770
770
  } else if (this._time > last._startTime + last._totalDuration / last._timeScale) {
771
771
  this._time = this.duration();
772
772
  this._totalTime = this._totalDuration;
@@ -1204,7 +1204,7 @@
1204
1204
 
1205
1205
  p.constructor = TimelineMax;
1206
1206
  p.kill()._gc = false;
1207
- TimelineMax.version = "1.11.4";
1207
+ TimelineMax.version = "1.11.5";
1208
1208
 
1209
1209
  p.invalidate = function() {
1210
1210
  this._yoyo = (this.vars.yoyo === true);
@@ -2226,7 +2226,7 @@
2226
2226
  p = CSSPlugin.prototype = new TweenPlugin("css");
2227
2227
 
2228
2228
  p.constructor = CSSPlugin;
2229
- CSSPlugin.version = "1.11.4";
2229
+ CSSPlugin.version = "1.11.5";
2230
2230
  CSSPlugin.API = 2;
2231
2231
  CSSPlugin.defaultTransformPerspective = 0;
2232
2232
  p = "px"; //we'll reuse the "p" variable to keep file size down
@@ -2292,7 +2292,7 @@
2292
2292
  _prefixCSS = "", //the non-camelCase vendor prefix like "-o-", "-moz-", "-ms-", or "-webkit-"
2293
2293
  _prefix = "", //camelCase vendor prefix like "O", "ms", "Webkit", or "Moz".
2294
2294
 
2295
- //@private feed in a camelCase property name like "transform" and it will check to see if it is valid as-is or if it needs a vendor prefix. It returns the corrected camelCase property name (i.e. "WebkitTransform" or "MozTransform" or "transform" or null if no such property is found, like if the browser is IE8 or before, "transform" won't be found at all)
2295
+ // @private feed in a camelCase property name like "transform" and it will check to see if it is valid as-is or if it needs a vendor prefix. It returns the corrected camelCase property name (i.e. "WebkitTransform" or "MozTransform" or "transform" or null if no such property is found, like if the browser is IE8 or before, "transform" won't be found at all)
2296
2296
  _checkPropPrefix = function(p, e) {
2297
2297
  e = e || _tempDiv;
2298
2298
  var s = e.style,
@@ -2387,7 +2387,7 @@
2387
2387
  return t["offset" + dim] - (_convertToPixels(t, p, parseFloat(v), v.replace(_suffixExp, "")) || 0);
2388
2388
  },
2389
2389
 
2390
- //@private returns at object containing ALL of the style properties in camelCase and their associated values.
2390
+ // @private returns at object containing ALL of the style properties in camelCase and their associated values.
2391
2391
  _getAllStyles = function(t, cs) {
2392
2392
  var s = {},
2393
2393
  i, tr;
@@ -2403,7 +2403,7 @@
2403
2403
  }
2404
2404
  } else if ((cs = t.currentStyle || t.style)) {
2405
2405
  for (i in cs) {
2406
- if (typeof(i) === "string" && s[i] !== undefined) {
2406
+ if (typeof(i) === "string" && s[i] === undefined) {
2407
2407
  s[i.replace(_camelExp, _camelFunc)] = cs[i];
2408
2408
  }
2409
2409
  }
@@ -2430,7 +2430,7 @@
2430
2430
  return s;
2431
2431
  },
2432
2432
 
2433
- //@private analyzes two style objects (as returned by _getAllStyles()) and only looks for differences between them that contain tweenable values (like a number or color). It returns an object with a "difs" property which refers to an object containing only those isolated properties and values for tweening, and a "firstMPT" property which refers to the first MiniPropTween instance in a linked list that recorded all the starting values of the different properties so that we can revert to them at the end or beginning of the tween - we don't want the cascading to get messed up. The forceLookup parameter is an optional generic object with properties that should be forced into the results - this is necessary for className tweens that are overwriting others because imagine a scenario where a rollover/rollout adds/removes a class and the user swipes the mouse over the target SUPER fast, thus nothing actually changed yet and the subsequent comparison of the properties would indicate they match (especially when px rounding is taken into consideration), thus no tweening is necessary even though it SHOULD tween and remove those properties after the tween (otherwise the inline styles will contaminate things). See the className SpecialProp code for details.
2433
+ // @private analyzes two style objects (as returned by _getAllStyles()) and only looks for differences between them that contain tweenable values (like a number or color). It returns an object with a "difs" property which refers to an object containing only those isolated properties and values for tweening, and a "firstMPT" property which refers to the first MiniPropTween instance in a linked list that recorded all the starting values of the different properties so that we can revert to them at the end or beginning of the tween - we don't want the cascading to get messed up. The forceLookup parameter is an optional generic object with properties that should be forced into the results - this is necessary for className tweens that are overwriting others because imagine a scenario where a rollover/rollout adds/removes a class and the user swipes the mouse over the target SUPER fast, thus nothing actually changed yet and the subsequent comparison of the properties would indicate they match (especially when px rounding is taken into consideration), thus no tweening is necessary even though it SHOULD tween and remove those properties after the tween (otherwise the inline styles will contaminate things). See the className SpecialProp code for details.
2434
2434
  _cssDif = function(t, s1, s2, vars, forceLookup) {
2435
2435
  var difs = {},
2436
2436
  style = t.style,
@@ -2474,7 +2474,7 @@
2474
2474
  return v;
2475
2475
  },
2476
2476
 
2477
- //@private Parses position-related complex strings like "top left" or "50px 10px" or "70% 20%", etc. which are used for things like transformOrigin or backgroundPosition. Optionally decorates a supplied object (recObj) with the following properties: "ox" (offsetX), "oy" (offsetY), "oxp" (if true, "ox" is a percentage not a pixel value), and "oxy" (if true, "oy" is a percentage not a pixel value)
2477
+ // @private Parses position-related complex strings like "top left" or "50px 10px" or "70% 20%", etc. which are used for things like transformOrigin or backgroundPosition. Optionally decorates a supplied object (recObj) with the following properties: "ox" (offsetX), "oy" (offsetY), "oxp" (if true, "ox" is a percentage not a pixel value), and "oxy" (if true, "oy" is a percentage not a pixel value)
2478
2478
  _parsePosition = function(v, recObj) {
2479
2479
  if (v == null || v === "" || v === "auto" || v === "auto auto") { //note: Firefox uses "auto auto" as default whereas Chrome uses "auto".
2480
2480
  v = "0 0";
@@ -2738,7 +2738,7 @@
2738
2738
  };
2739
2739
  },
2740
2740
 
2741
- //@private used when other plugins must tween values first, like BezierPlugin or ThrowPropsPlugin, etc. That plugin's setRatio() gets called first so that the values are updated, and then we loop through the MiniPropTweens which handle copying the values into their appropriate slots so that they can then be applied correctly in the main CSSPlugin setRatio() method. Remember, we typically create a proxy object that has a bunch of uniquely-named properties that we feed to the sub-plugin and it does its magic normally, and then we must interpret those values and apply them to the css because often numbers must get combined/concatenated, suffixes added, etc. to work with css, like boxShadow could have 4 values plus a color.
2741
+ // @private used when other plugins must tween values first, like BezierPlugin or ThrowPropsPlugin, etc. That plugin's setRatio() gets called first so that the values are updated, and then we loop through the MiniPropTweens which handle copying the values into their appropriate slots so that they can then be applied correctly in the main CSSPlugin setRatio() method. Remember, we typically create a proxy object that has a bunch of uniquely-named properties that we feed to the sub-plugin and it does its magic normally, and then we must interpret those values and apply them to the css because often numbers must get combined/concatenated, suffixes added, etc. to work with css, like boxShadow could have 4 values plus a color.
2742
2742
  _setPluginRatio = _internals._setPluginRatio = function(v) {
2743
2743
  this.plugin.setRatio(v);
2744
2744
  var d = this.data,
@@ -5880,7 +5880,7 @@
5880
5880
  p._firstPT = p._targets = p._overwrittenProps = p._startAt = null;
5881
5881
  p._notifyPluginsOfEnabled = false;
5882
5882
 
5883
- TweenLite.version = "1.11.4";
5883
+ TweenLite.version = "1.11.5";
5884
5884
  TweenLite.defaultEase = p._ease = new Ease(null, null, 1, 1);
5885
5885
  TweenLite.defaultOverwrite = "auto";
5886
5886
  TweenLite.ticker = _ticker;
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 1.11.4
3
- * DATE: 2014-01-18
2
+ * VERSION: 1.11.5
3
+ * DATE: 2014-02-20
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.4";
32
+ CSSPlugin.version = "1.11.5";
33
33
  CSSPlugin.API = 2;
34
34
  CSSPlugin.defaultTransformPerspective = 0;
35
35
  p = "px"; //we'll reuse the "p" variable to keep file size down
@@ -95,7 +95,7 @@
95
95
  _prefixCSS = "", //the non-camelCase vendor prefix like "-o-", "-moz-", "-ms-", or "-webkit-"
96
96
  _prefix = "", //camelCase vendor prefix like "O", "ms", "Webkit", or "Moz".
97
97
 
98
- //@private feed in a camelCase property name like "transform" and it will check to see if it is valid as-is or if it needs a vendor prefix. It returns the corrected camelCase property name (i.e. "WebkitTransform" or "MozTransform" or "transform" or null if no such property is found, like if the browser is IE8 or before, "transform" won't be found at all)
98
+ // @private feed in a camelCase property name like "transform" and it will check to see if it is valid as-is or if it needs a vendor prefix. It returns the corrected camelCase property name (i.e. "WebkitTransform" or "MozTransform" or "transform" or null if no such property is found, like if the browser is IE8 or before, "transform" won't be found at all)
99
99
  _checkPropPrefix = function(p, e) {
100
100
  e = e || _tempDiv;
101
101
  var s = e.style,
@@ -190,7 +190,7 @@
190
190
  return t["offset" + dim] - (_convertToPixels(t, p, parseFloat(v), v.replace(_suffixExp, "")) || 0);
191
191
  },
192
192
 
193
- //@private returns at object containing ALL of the style properties in camelCase and their associated values.
193
+ // @private returns at object containing ALL of the style properties in camelCase and their associated values.
194
194
  _getAllStyles = function(t, cs) {
195
195
  var s = {},
196
196
  i, tr;
@@ -206,7 +206,7 @@
206
206
  }
207
207
  } else if ((cs = t.currentStyle || t.style)) {
208
208
  for (i in cs) {
209
- if (typeof(i) === "string" && s[i] !== undefined) {
209
+ if (typeof(i) === "string" && s[i] === undefined) {
210
210
  s[i.replace(_camelExp, _camelFunc)] = cs[i];
211
211
  }
212
212
  }
@@ -233,7 +233,7 @@
233
233
  return s;
234
234
  },
235
235
 
236
- //@private analyzes two style objects (as returned by _getAllStyles()) and only looks for differences between them that contain tweenable values (like a number or color). It returns an object with a "difs" property which refers to an object containing only those isolated properties and values for tweening, and a "firstMPT" property which refers to the first MiniPropTween instance in a linked list that recorded all the starting values of the different properties so that we can revert to them at the end or beginning of the tween - we don't want the cascading to get messed up. The forceLookup parameter is an optional generic object with properties that should be forced into the results - this is necessary for className tweens that are overwriting others because imagine a scenario where a rollover/rollout adds/removes a class and the user swipes the mouse over the target SUPER fast, thus nothing actually changed yet and the subsequent comparison of the properties would indicate they match (especially when px rounding is taken into consideration), thus no tweening is necessary even though it SHOULD tween and remove those properties after the tween (otherwise the inline styles will contaminate things). See the className SpecialProp code for details.
236
+ // @private analyzes two style objects (as returned by _getAllStyles()) and only looks for differences between them that contain tweenable values (like a number or color). It returns an object with a "difs" property which refers to an object containing only those isolated properties and values for tweening, and a "firstMPT" property which refers to the first MiniPropTween instance in a linked list that recorded all the starting values of the different properties so that we can revert to them at the end or beginning of the tween - we don't want the cascading to get messed up. The forceLookup parameter is an optional generic object with properties that should be forced into the results - this is necessary for className tweens that are overwriting others because imagine a scenario where a rollover/rollout adds/removes a class and the user swipes the mouse over the target SUPER fast, thus nothing actually changed yet and the subsequent comparison of the properties would indicate they match (especially when px rounding is taken into consideration), thus no tweening is necessary even though it SHOULD tween and remove those properties after the tween (otherwise the inline styles will contaminate things). See the className SpecialProp code for details.
237
237
  _cssDif = function(t, s1, s2, vars, forceLookup) {
238
238
  var difs = {},
239
239
  style = t.style,
@@ -277,7 +277,7 @@
277
277
  return v;
278
278
  },
279
279
 
280
- //@private Parses position-related complex strings like "top left" or "50px 10px" or "70% 20%", etc. which are used for things like transformOrigin or backgroundPosition. Optionally decorates a supplied object (recObj) with the following properties: "ox" (offsetX), "oy" (offsetY), "oxp" (if true, "ox" is a percentage not a pixel value), and "oxy" (if true, "oy" is a percentage not a pixel value)
280
+ // @private Parses position-related complex strings like "top left" or "50px 10px" or "70% 20%", etc. which are used for things like transformOrigin or backgroundPosition. Optionally decorates a supplied object (recObj) with the following properties: "ox" (offsetX), "oy" (offsetY), "oxp" (if true, "ox" is a percentage not a pixel value), and "oxy" (if true, "oy" is a percentage not a pixel value)
281
281
  _parsePosition = function(v, recObj) {
282
282
  if (v == null || v === "" || v === "auto" || v === "auto auto") { //note: Firefox uses "auto auto" as default whereas Chrome uses "auto".
283
283
  v = "0 0";
@@ -541,7 +541,7 @@
541
541
  };
542
542
  },
543
543
 
544
- //@private used when other plugins must tween values first, like BezierPlugin or ThrowPropsPlugin, etc. That plugin's setRatio() gets called first so that the values are updated, and then we loop through the MiniPropTweens which handle copying the values into their appropriate slots so that they can then be applied correctly in the main CSSPlugin setRatio() method. Remember, we typically create a proxy object that has a bunch of uniquely-named properties that we feed to the sub-plugin and it does its magic normally, and then we must interpret those values and apply them to the css because often numbers must get combined/concatenated, suffixes added, etc. to work with css, like boxShadow could have 4 values plus a color.
544
+ // @private used when other plugins must tween values first, like BezierPlugin or ThrowPropsPlugin, etc. That plugin's setRatio() gets called first so that the values are updated, and then we loop through the MiniPropTweens which handle copying the values into their appropriate slots so that they can then be applied correctly in the main CSSPlugin setRatio() method. Remember, we typically create a proxy object that has a bunch of uniquely-named properties that we feed to the sub-plugin and it does its magic normally, and then we must interpret those values and apply them to the css because often numbers must get combined/concatenated, suffixes added, etc. to work with css, like boxShadow could have 4 values plus a color.
545
545
  _setPluginRatio = _internals._setPluginRatio = function(v) {
546
546
  this.plugin.setRatio(v);
547
547
  var d = this.data,
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: beta 0.6.0
3
- * DATE: 2013-07-03
2
+ * VERSION: beta 0.6.1
3
+ * DATE: 2014-01-20
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
@@ -26,6 +26,7 @@
26
26
 
27
27
  p._propName = "cssRule";
28
28
  p.constructor = CSSRulePlugin;
29
+ CSSRulePlugin.version = "0.6.1";
29
30
  CSSRulePlugin.API = 2;
30
31
 
31
32
  /**
@@ -70,12 +71,12 @@
70
71
  };
71
72
 
72
73
 
73
- //@private gets called when the tween renders for the first time. This kicks everything off, recording start/end values, etc.
74
+ // @private gets called when the tween renders for the first time. This kicks everything off, recording start/end values, etc.
74
75
  p._onInitTween = function(target, value, tween) {
75
76
  if (target.cssText === undefined) {
76
77
  return false;
77
78
  }
78
- var div = _doc.createElement("div");
79
+ var div = target._gsProxy = target._gsProxy || _doc.createElement("div");
79
80
  this._ss = target;
80
81
  this._proxy = div.style;
81
82
  div.style.cssText = target.cssText;
@@ -85,7 +86,7 @@
85
86
 
86
87
 
87
88
 
88
- //@private gets called every time the tween updates, passing the new ratio (typically a value between 0 and 1, but not always (for example, if an Elastic.easeOut is used, the value can jump above 1 mid-tween). It will always start and 0 and end at 1.
89
+ // @private gets called every time the tween updates, passing the new ratio (typically a value between 0 and 1, but not always (for example, if an Elastic.easeOut is used, the value can jump above 1 mid-tween). It will always start and 0 and end at 1.
89
90
  p.setRatio = function(v) {
90
91
  _superSetRatio.call(this, v);
91
92
  this._ss.cssText = this._proxy.cssText;
@@ -0,0 +1,70 @@
1
+ /*!
2
+ * VERSION: 0.1.0
3
+ * DATE: 2014-02-20
4
+ * UPDATES AND DOCS AT: http://www.greensock.com
5
+ *
6
+ * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
7
+ * This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for
8
+ * Club GreenSock members, the software agreement that was issued with your membership.
9
+ *
10
+ * @author: Jack Doyle, jack@greensock.com
11
+ */
12
+ (window._gsQueue || (window._gsQueue = [])).push( function() {
13
+
14
+ "use strict";
15
+
16
+ window._gsDefine.plugin({
17
+ propName: "endArray",
18
+ API: 2,
19
+ version: "0.1.0",
20
+
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
+ init: function(target, value, tween) {
23
+ var i = value.length,
24
+ a = this.a = [],
25
+ start, end;
26
+ this.target = target;
27
+ this._round = false;
28
+ if (!i) {
29
+ return false;
30
+ }
31
+ while (--i > -1) {
32
+ start = target[i];
33
+ end = value[i];
34
+ if (start !== end) {
35
+ a.push({i:i, s:start, c:end - start});
36
+ }
37
+ }
38
+ return true;
39
+ },
40
+
41
+ round: function(lookup) {
42
+ if ("endArray" in lookup) {
43
+ this._round = true;
44
+ }
45
+ },
46
+
47
+ //called each time the values should be updated, and the ratio gets passed as the only parameter (typically it's a value between 0 and 1, but it can exceed those when using an ease like Elastic.easeOut or Back.easeOut, etc.)
48
+ set: function(ratio) {
49
+ var target = this.target,
50
+ a = this.a,
51
+ i = a.length,
52
+ e, val;
53
+ if (this._round) {
54
+ while (--i > -1) {
55
+ e = a[i];
56
+ val = e.s + e.c * ratio;
57
+ target[e.i] = (val + ((val > 0) ? 0.5 : -0.5)) | 0; //about 4x faster than Math.round();
58
+ }
59
+ } else {
60
+ while (--i > -1) {
61
+ e = a[i];
62
+ val = e.s + e.c * ratio;
63
+ target[e.i] = (val < 0.000001 && val > -0.000001) ? 0 : val;
64
+ }
65
+ }
66
+ }
67
+
68
+ });
69
+
70
+ }); if (window._gsDefine) { window._gsQueue.pop()(); }
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 0.5.0
3
- * DATE: 2014-01-18
2
+ * VERSION: 0.5.1
3
+ * DATE: 2014-02-14
4
4
  * UPDATES AND DOCS AT: http://www.greensock.com
5
5
  *
6
6
  * @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
@@ -128,7 +128,7 @@
128
128
  _createGetterSetter = function(getter, setter) {
129
129
  return function(value) {return (arguments.length) ? setter(value) : getter(); };
130
130
  },
131
- //looks at every property in the vars and converts them (when appropriate) to the KineticJS equivalent, like "x" would become "setX", "rotation" would be "setRotation", etc. If it finds a special property for which "x" and "y" must be split apart (like scale, offset, shadowOffset, etc.), it will do that as well, and if the getters and setters aren't already on the object (like setScaleX, setScaleY, getScaleX, and getScaleY), it'll add those to the target itself (actually, its prototype if available). This method returns an array of any names it had to change (like "x", "y", "scale", etc.) so that they can be used in the overwriteProps array.
131
+ //looks at every property in the vars and converts them (when appropriate) to the KineticJS equivalent. If it finds a special property for which "x" and "y" must be split apart (like scale, offset, shadowOffset, etc.), it will do that as well. This method returns an array of any names it had to change (like "x", "y", "scale", etc.) so that they can be used in the overwriteProps array.
132
132
  _convertProps = function(target, vars) {
133
133
  var converted = [],
134
134
  p, val, i, proto;
@@ -180,10 +180,10 @@
180
180
  }
181
181
  }
182
182
 
183
- window._gsDefine.plugin({
183
+ var KineticPlugin = window._gsDefine.plugin({
184
184
  propName: "kinetic",
185
185
  API: 2,
186
- version: "0.5.0",
186
+ version: "0.5.1",
187
187
 
188
188
  //called when the tween renders for the first time. This is where initial values should be recorded and any setup routines should run.
189
189
  init: function(target, value, tween) {
@@ -239,9 +239,12 @@
239
239
  directionalRotationPlugin._onInitTween(target, gp, tween);
240
240
  this._addTween(directionalRotationPlugin, "setRatio", 0, 1, p);
241
241
 
242
+ } else if (val instanceof Array) { //for array-based values like "points"
243
+ this._initArrayTween(target[p](), val, p);
244
+
242
245
  } else if (p !== "autoDraw") {
243
246
  gp = "get" + p.substr(3);
244
- this._addTween(target, p, ((typeof(target[p]) === "function") ? target[( typeof(target[gp]) === "function" ? gp : p)]() : target[p]) || 0, val, p);
247
+ this._addTween(target, p, ((typeof(target[p]) === "function") ? target[( (gp !== "get" && typeof(target[gp]) === "function") ? gp : p)]() : target[p]) || 0, val, p);
245
248
  }
246
249
  this._overwriteProps.push(p);
247
250
  }
@@ -274,7 +277,8 @@
274
277
  this._super.setRatio.call(this, ratio);
275
278
  var sp = this._firstSP,
276
279
  layer = this._layer,
277
- t, proxy;
280
+ arrayTweens = this._arrayTweens,
281
+ i, e, p, val, t, proxy;
278
282
  if (sp) {
279
283
  t = this._target;
280
284
  while (sp) {
@@ -283,6 +287,17 @@
283
287
  sp = sp._next;
284
288
  }
285
289
  }
290
+ if (arrayTweens) {
291
+ i = arrayTweens.length;
292
+ while (--i > -1) {
293
+ e = arrayTweens[i];
294
+ val = e.s + e.c * ratio;
295
+ e.a[e.i] = (val < 0.000001 && val > -0.000001) ? 0 : val;
296
+ }
297
+ for (p in this._arrayProps) {
298
+ this._target[p](this._arrayProps[p]);
299
+ }
300
+ }
286
301
  if (layer && !layer._gsDraw) {
287
302
  _layersToDraw.push(layer);
288
303
  layer._gsDraw = true; //a flag indicating that we need to draw() this layer as soon as all the tweens have finished updating (using a "tick" event listener)
@@ -295,4 +310,25 @@
295
310
 
296
311
  });
297
312
 
313
+ p = KineticPlugin.prototype;
314
+ p._initArrayTween = function(a, b, prop) {
315
+ if (!this._arrayTweens) {
316
+ this._arrayTweens = []; //stores data about any elements that must tween (ones that match in a and b are ignored (no need to waste resources). For example, {a:array, i:0, s:100, c:50}
317
+ this._arrayProps = {}; //stores data about which properties are associted with which arrays so that we can apply them in the setRatio() method, like target[property](array), as in target.points([1,2,500,600]);
318
+ }
319
+ var i = a.length,
320
+ tweens = this._arrayTweens,
321
+ start, end;
322
+ while (--i > -1) {
323
+ start = a[i];
324
+ end = b[i];
325
+ if (start !== end) {
326
+ tweens.push({a:a, i:i, s:start, c:end - start});
327
+ }
328
+ }
329
+ if (tweens.length) {
330
+ this._arrayProps[prop] = a;
331
+ }
332
+ };
333
+
298
334
  }); if (window._gsDefine) { window._gsQueue.pop()(); }
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * VERSION: 0.9.9
3
- * DATE: 2014-01-18
2
+ * VERSION: 0.10.0
3
+ * DATE: 2014-02-20
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/).
@@ -28,6 +28,7 @@
28
28
  _emptyFunc = function() { return false; },
29
29
  _RAD2DEG = 180 / Math.PI,
30
30
  _max = 999999999999999,
31
+ _getTime = Date.now || function() {return new Date().getTime();},
31
32
  _isOldIE = (_doc.all && !_doc.addEventListener),
32
33
  _renderQueue = [],
33
34
  _lookup = {}, //when a Draggable is created, the target gets a unique _gsDragID property that allows gets associated with the Draggable instance for quick lookups in Draggable.get(). This avoids circular references that could cause gc problems.
@@ -36,6 +37,7 @@
36
37
  _dragCount = 0, //total number of elements currently being dragged
37
38
  _prefix,
38
39
  _isMultiTouching,
40
+ _lastDragTime = 0,
39
41
  ThrowPropsPlugin,
40
42
 
41
43
  _renderQueueTick = function() {
@@ -507,6 +509,8 @@
507
509
  offsetLeft = 0,
508
510
  prevTop = element.scrollTop,
509
511
  prevLeft = element.scrollLeft,
512
+ scrollWidth = element.scrollWidth,
513
+ scrollHeight = element.scrollHeight,
510
514
  extraPadRight = 0,
511
515
  maxLeft = 0,
512
516
  maxTop = 0,
@@ -652,7 +656,7 @@
652
656
  x, y;
653
657
  prevTop = element.scrollTop;
654
658
  prevLeft = element.scrollLeft;
655
- if (widthMatches && element.clientHeight === elementHeight && content.offsetHeight === contentHeight && !force) {
659
+ if (widthMatches && element.clientHeight === elementHeight && content.offsetHeight === contentHeight && scrollWidth === element.scrollWidth && scrollHeight === element.scrollHeight && !force) {
656
660
  return; //no need to recalculate things if the width and height haven't changed.
657
661
  }
658
662
  if (offsetTop || offsetLeft) {
@@ -686,6 +690,8 @@
686
690
  }
687
691
  elementWidth = element.clientWidth;
688
692
  elementHeight = element.clientHeight;
693
+ scrollWidth = element.scrollWidth;
694
+ scrollHeight = element.scrollHeight;
689
695
  maxLeft = element.scrollWidth - elementWidth;
690
696
  maxTop = element.scrollHeight - elementHeight;
691
697
  contentHeight = content.offsetHeight;
@@ -727,6 +733,7 @@
727
733
  self = this,
728
734
  trigger = _unwrapElement(vars.trigger || vars.handle || target),
729
735
  killProps = {},
736
+ dragEndTime = 0,
730
737
  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,
731
738
 
732
739
  //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.
@@ -969,7 +976,7 @@
969
976
  buildSnapFunc = function(snap, min, max, factor) {
970
977
  if (typeof(snap) === "function") {
971
978
  return function(n) {
972
- var edgeTolerance = !self.isDragging ? 1 : 1 - self.edgeResistance; //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)
979
+ var edgeTolerance = !self.isPressed ? 1 : 1 - self.edgeResistance; //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)
973
980
  return snap.call(self, (n > max ? max + (n - max) * edgeTolerance : (n < min) ? min + (n - min) * edgeTolerance : n)) * factor;
974
981
  };
975
982
  }
@@ -999,7 +1006,7 @@
999
1006
  //called when the mouse is pressed (or touch starts)
1000
1007
  onPress = function(e) {
1001
1008
  var temp;
1002
- if (self.isDragging || !e) { //just in case the browser dispatches a "touchstart" and "mousedown" (some browsers emulate mouse events when using touches)
1009
+ if (self.isPressed || !e) { //just in case the browser dispatches a "touchstart" and "mousedown" (some browsers emulate mouse events when using touches)
1003
1010
  return;
1004
1011
  }
1005
1012
  interrupted = isTweening();
@@ -1054,18 +1061,17 @@
1054
1061
  if (!rotationMode && !scrollProxy && vars.zIndexBoost !== false) {
1055
1062
  target.style.zIndex = Draggable.zIndex++;
1056
1063
  }
1057
- self.isDragging = true;
1064
+ self.isPressed = true;
1058
1065
  hasDragCallback = !!(vars.onDrag || self._listeners.drag);
1059
- dirty = false;
1060
1066
  if (!rotationMode) {
1061
1067
  _setStyle(trigger, "cursor", vars.cursor || "move");
1062
1068
  }
1063
- _dispatchEvent(self, "dragstart", "onDragStart");
1069
+ _dispatchEvent(self, "press", "onPress");
1064
1070
  },
1065
1071
 
1066
1072
  //called every time the mouse/touch moves
1067
1073
  onMove = function(e) {
1068
- if (_isMultiTouching || !self.isDragging) {
1074
+ if (_isMultiTouching || !self.isPressed) {
1069
1075
  return;
1070
1076
  }
1071
1077
  if (_isOldIE) {
@@ -1095,7 +1101,6 @@
1095
1101
  }
1096
1102
  mouseX = self.pointerX = e.pageX;
1097
1103
  mouseY = self.pointerY = e.pageY;
1098
- 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)
1099
1104
 
1100
1105
  if (rotationMode) {
1101
1106
  y = Math.atan2(rotationOrigin.y - e.pageY, e.pageX - rotationOrigin.x) * _RAD2DEG;
@@ -1163,8 +1168,11 @@
1163
1168
  } else {
1164
1169
  self.y = self.endY = y;
1165
1170
  }
1166
- } else {
1167
- dirty = false;
1171
+ 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)
1172
+ if (!self.isDragging) {
1173
+ self.isDragging = true;
1174
+ _dispatchEvent(self, "dragstart", "onDragStart");
1175
+ }
1168
1176
  }
1169
1177
  },
1170
1178
 
@@ -1173,8 +1181,10 @@
1173
1181
  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)
1174
1182
  return;
1175
1183
  }
1184
+ self.isPressed = false;
1176
1185
  var originalEvent = e,
1177
- touches, xChange, yChange, i;
1186
+ wasDragging = self.isDragging,
1187
+ touches, i;
1178
1188
  if (touchEventTarget) {
1179
1189
  _removeListener(touchEventTarget, "touchend", onRelease);
1180
1190
  _removeListener(touchEventTarget, "touchmove", onMove);
@@ -1189,6 +1199,7 @@
1189
1199
  if (e) {
1190
1200
  _removeListener(e.target, "change", onRelease);
1191
1201
  }
1202
+ _dispatchEvent(self, "release", "onRelease");
1192
1203
  _dispatchEvent(self, "click", "onClick");
1193
1204
  isClicking = false;
1194
1205
  return;
@@ -1197,7 +1208,10 @@
1197
1208
  if (!rotationMode) {
1198
1209
  _setStyle(trigger, "cursor", vars.cursor || "move");
1199
1210
  }
1200
- self.isDragging = false;
1211
+ if (wasDragging) {
1212
+ dragEndTime = _lastDragTime = _getTime();
1213
+ self.isDragging = false;
1214
+ }
1201
1215
  _dragCount--;
1202
1216
  if (e) {
1203
1217
  if (_isOldIE) {
@@ -1217,13 +1231,12 @@
1217
1231
  self.pointerEvent = originalEvent;
1218
1232
  self.pointerX = e.pageX;
1219
1233
  self.pointerY = e.pageY;
1220
- yChange = (e.pageY - startMouseY);
1221
- xChange = (e.pageX - startMouseX);
1222
1234
  }
1223
- if (originalEvent && xChange < 2 && xChange > -2 && yChange < 2 && yChange > -2) {
1235
+ if (originalEvent && !wasDragging) {
1224
1236
  if (interrupted && vars.snap) { //otherwise, if the user clicks on the object while it's animating to a snapped position, and then releases without moving 3 pixels, it will just stay there (it should animate/snap)
1225
1237
  animate(vars.throwProps);
1226
1238
  }
1239
+ _dispatchEvent(self, "release", "onRelease");
1227
1240
  _dispatchEvent(self, "click", "onClick");
1228
1241
  } else {
1229
1242
  animate(vars.throwProps); //will skip if throwProps isn't defined or ThrowPropsPlugin isn't loaded.
@@ -1233,9 +1246,21 @@
1233
1246
  originalEvent.preventManipulation(); //for some Microsoft browsers
1234
1247
  }
1235
1248
  }
1249
+ _dispatchEvent(self, "release", "onRelease");
1250
+ }
1251
+ if (wasDragging) {
1252
+ _dispatchEvent(self, "dragend", "onDragEnd");
1236
1253
  }
1237
- _dispatchEvent(self, "dragend", "onDragEnd");
1238
1254
  return true;
1255
+ },
1256
+
1257
+ onClick = function(e) {
1258
+ if (self.isPressed || _getTime() - dragEndTime < 20) {
1259
+ e.preventDefault();
1260
+ if (e.preventManipulation) {
1261
+ e.preventManipulation(); //for some Microsoft browsers
1262
+ }
1263
+ }
1239
1264
  };
1240
1265
 
1241
1266
  old = Draggable.get(this.target);
@@ -1244,10 +1269,22 @@
1244
1269
  }
1245
1270
 
1246
1271
  //give the user access to start/stop dragging...
1247
- this.startDrag = onPress;
1272
+ this.startDrag = function(e) {
1273
+ onPress(e);
1274
+ if (!self.isDragging) {
1275
+ self.isDragging = true;
1276
+ _dispatchEvent(self, "dragstart", "onDragStart");
1277
+ }
1278
+ };
1248
1279
  this.endDrag = function(e) {
1249
1280
  onRelease(e, true);
1250
1281
  };
1282
+ this.timeSinceDrag = function() {
1283
+ return self.isDragging ? 0 : (_getTime() - dragEndTime) / 1000;
1284
+ };
1285
+ this.hitTest = function(target, threshold) {
1286
+ return Draggable.hitTest(self.target, target, threshold);
1287
+ };
1251
1288
 
1252
1289
  this.applyBounds = function(newBounds) {
1253
1290
  var x, y;
@@ -1294,7 +1331,7 @@
1294
1331
  } else {
1295
1332
  syncXY(true);
1296
1333
  }
1297
- if (self.isDragging && (x !== self.x || (y !== self.y && !rotationMode))) {
1334
+ if (self.isPressed && (x !== self.x || (y !== self.y && !rotationMode))) {
1298
1335
  recordStartPositions();
1299
1336
  }
1300
1337
  return self;
@@ -1304,6 +1341,7 @@
1304
1341
  var id;
1305
1342
  _addListener(trigger, "mousedown", onPress);
1306
1343
  _addListener(trigger, "touchstart", onPress);
1344
+ _addListener(trigger, "click", onClick);
1307
1345
  if (!rotationMode) {
1308
1346
  _setStyle(trigger, "cursor", vars.cursor || "move");
1309
1347
  }
@@ -1339,6 +1377,7 @@
1339
1377
  _setStyle(trigger, "MSTouchAction", "auto");
1340
1378
  _removeListener(trigger, "mousedown", onPress);
1341
1379
  _removeListener(trigger, "touchstart", onPress);
1380
+ _removeListener(trigger, "click", onClick);
1342
1381
  if (touchEventTarget) {
1343
1382
  _removeListener(touchEventTarget, "touchcancel", onRelease);
1344
1383
  _removeListener(touchEventTarget, "touchend", onRelease);
@@ -1353,7 +1392,7 @@
1353
1392
  scrollProxy.disable();
1354
1393
  }
1355
1394
  _removeFromRenderQueue(render);
1356
- this.isDragging = isClicking = false;
1395
+ this.isDragging = this.isPressed = isClicking = false;
1357
1396
  if (dragging) {
1358
1397
  _dispatchEvent(this, "dragend", "onDragEnd");
1359
1398
  }
@@ -1368,7 +1407,7 @@
1368
1407
 
1369
1408
  if (type.indexOf("scroll") !== -1) {
1370
1409
  scrollProxy = this.scrollProxy = new ScrollProxy(target, _extend({onKill:function() { //ScrollProxy's onKill() gets called if/when the ScrollProxy senses that the user interacted with the scroll position manually (like using the scrollbar). IE9 doesn't fire the "mouseup" properly when users drag the scrollbar of an element, so this works around that issue.
1371
- if (self.isDragging) {
1410
+ if (self.isPressed) {
1372
1411
  onRelease(null);
1373
1412
  }}}, vars));
1374
1413
  //a bug in many Android devices' stock browser causes scrollTop to get forced back to 0 after it is altered via JS, so we set overflow to "hidden" on mobile/touch devices (they hide the scroll bar anyway). That works around the bug. (This bug is discussed at https://code.google.com/p/android/issues/detail?id=19625)
@@ -1400,19 +1439,27 @@
1400
1439
  tempVars.overwrite = false;
1401
1440
  }
1402
1441
 
1403
- this.isDragging = false;
1404
1442
  this.enable();
1405
1443
  },
1406
1444
  p = Draggable.prototype = new EventDispatcher();
1407
1445
 
1408
1446
  p.constructor = Draggable;
1409
1447
  p.pointerX = p.pointerY = 0;
1410
- Draggable.version = "0.9.9";
1448
+ p.isDragging = p.isPressed = false;
1449
+ Draggable.version = "0.10.0";
1411
1450
  Draggable.zIndex = 1000;
1412
1451
 
1413
1452
  _addListener(_doc, "touchcancel", function() {
1414
1453
  //some older Android devices intermittently stop dispatching "touchmove" events if we don't listen for "touchcancel" on the document. Very strange indeed.
1415
1454
  });
1455
+ _addListener(_doc, "contextmenu", function(e) {
1456
+ var p;
1457
+ for (p in _lookup) {
1458
+ if (_lookup[p].isPressed) {
1459
+ _lookup[p].endDrag();
1460
+ }
1461
+ }
1462
+ });
1416
1463
 
1417
1464
  Draggable.create = function(targets, vars) {
1418
1465
  if (typeof(targets) === "string") {
@@ -1430,6 +1477,49 @@
1430
1477
  return _lookup[(_unwrapElement(target) || {})._gsDragID];
1431
1478
  };
1432
1479
 
1480
+ Draggable.timeSinceDrag = function() {
1481
+ return (_getTime() - _lastDragTime) / 1000;
1482
+ };
1483
+
1484
+ var _parseRect = function(e, undefined) { //accepts a DOM element, a mouse event, or a rectangle object and returns the corresponding rectangle with left, right, width, height, top, and bottom properties
1485
+ var r = (e.pageX !== undefined) ? {left:e.pageX, top:e.pageY, right:e.pageX + 1, bottom:e.pageY + 1} : (!e.nodeType && e.left !== undefined && e.top !== undefined) ? e : _unwrapElement(e).getBoundingClientRect();
1486
+ if (r.right === undefined && r.width !== undefined) {
1487
+ r.right = r.left + r.width;
1488
+ r.bottom = r.top + r.height;
1489
+ } else if (!r.width) { //some browsers don't include width and height properties
1490
+ r.width = r.right - r.left;
1491
+ r.height = r.bottom - r.top;
1492
+ }
1493
+ return r;
1494
+ };
1495
+
1496
+ Draggable.hitTest = function(obj1, obj2, threshold) { //
1497
+ if (obj1 === obj2) {
1498
+ return false;
1499
+ }
1500
+ var r1 = _parseRect(obj1),
1501
+ r2 = _parseRect(obj2),
1502
+ isOutside = (r2.left > r1.right || r2.right < r1.left || r2.top > r1.bottom || r2.bottom < r1.top),
1503
+ overlap, area, isRatio;
1504
+ if (isOutside || !threshold) {
1505
+ return !isOutside;
1506
+ }
1507
+ isRatio = ((threshold + "").indexOf("%") !== -1);
1508
+ threshold = parseFloat(threshold) || 0;
1509
+ overlap = {left:Math.max(r1.left, r2.left), top:Math.max(r1.top, r2.top)};
1510
+ overlap.width = Math.min(r1.right, r2.right) - overlap.left;
1511
+ overlap.height = Math.min(r1.bottom, r2.bottom) - overlap.top;
1512
+ if (overlap.width < 0 || overlap.height < 0) {
1513
+ return false;
1514
+ }
1515
+ if (isRatio) {
1516
+ threshold *= 0.01;
1517
+ area = overlap.width * overlap.height;
1518
+ return (area >= r1.width * r1.height * threshold || area >= r2.width * r2.height * threshold);
1519
+ }
1520
+ return (overlap.width > threshold && overlap.height > threshold);
1521
+ };
1522
+
1433
1523
  return Draggable;
1434
1524
 
1435
1525
  }, true);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: greensock-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.4.1
4
+ version: 1.11.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Pataki, Greensock Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-17 00:00:00.000000000 Z
11
+ date: 2014-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  description: This gem provides TweenMax, TweenLite, TimelineMax, TimelineLite, and
42
- the GSAP jQuery plugin in uncompressed format for your Rails 3.1 application.
42
+ the GSAP jQuery plugin in uncompressed format for your Rails 3.1 (or newer) application.
43
43
  email:
44
44
  - robert@robertpataki.com
45
45
  executables: []
@@ -63,6 +63,7 @@ files:
63
63
  - vendor/assets/javascripts/greensock/plugins/ColorPropsPlugin.js
64
64
  - vendor/assets/javascripts/greensock/plugins/DirectionalRotationPlugin.js
65
65
  - vendor/assets/javascripts/greensock/plugins/EaselPlugin.js
66
+ - vendor/assets/javascripts/greensock/plugins/EndArrayPlugin.js
66
67
  - vendor/assets/javascripts/greensock/plugins/KineticPlugin.js
67
68
  - vendor/assets/javascripts/greensock/plugins/RaphaelPlugin.js
68
69
  - vendor/assets/javascripts/greensock/plugins/RoundPropsPlugin.js