diff options
author | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2013-12-10 17:18:07 +0100 |
---|---|---|
committer | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2013-12-10 17:18:07 +0100 |
commit | 4486175d10fc327fd22a28c3d24bb891216271b2 (patch) | |
tree | 9f4e79075523e2144758fd6e089db4c158c52f18 | |
parent | 782f2b7f683cbf859d483140744c5852065aae0c (diff) | |
download | gwtquery-4486175d10fc327fd22a28c3d24bb891216271b2.tar.gz gwtquery-4486175d10fc327fd22a28c3d24bb891216271b2.zip |
Rolling back to transitionEnd since setting transitionEnd made custom events fail (slideEnter)
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/Transitions.java | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/Transitions.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/Transitions.java index ab9209dc..da314fbb 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/Transitions.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/Transitions.java @@ -32,6 +32,7 @@ import com.google.gwt.query.client.plugins.effects.PropertiesAnimation.EasingCur import com.google.gwt.regexp.shared.MatchResult; import com.google.gwt.regexp.shared.RegExp; import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.Timer; /** * Transitions and transformation plugin for gQuery. @@ -323,7 +324,7 @@ public class Transitions extends GQuery { // This is called once per element final String oldTransitionValue = $(this).css(transition); // Recompute delay based on the time spent in the queue - double d = Math.max(0, delay - (int)(Duration.currentTimeMillis() - queuedAt)); + int d = Math.max(0, delay - (int)(Duration.currentTimeMillis() - queuedAt)); // Generate transition value String attribs = duration + "ms" + " " + ease + " " + d + "ms"; String newTransitionValue = ""; @@ -331,20 +332,20 @@ public class Transitions extends GQuery { newTransitionValue += (newTransitionValue.isEmpty() ? "" : ", ") + s + " " + attribs; } - $(this) - // Configure animation using transition property - .css(transition, newTransitionValue) - // Set all css properties for this transition using the css method in this class - .as(Transitions).css(p) - // Bind to transitionEnd to unlock the queue and restore old transitions - .bind(transitionEnd, new Function(){ - public void f(){ - $(this).dequeue() - .unbind(transitionEnd) - .css(transition, oldTransitionValue) - .each(funcs); - } - }); + final Transitions g = $(this).as(Transitions); + // Configure animation using transition property + g.css(transition, newTransitionValue); + // Set all css properties for this transition using the css method in this class + g.css(p); + + // TODO: Use transitionEnd events once GQuery supports non-bit events + // last time I tried, setting 'transitionEnd' made custom events fail (slideEnter) + new Timer() { + public void run() { + g.css(transition, oldTransitionValue).each(funcs); + dequeue(); + } + }.schedule(d + duration); } }); |