diff options
author | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2013-12-10 09:48:12 +0100 |
---|---|---|
committer | Manuel Carrasco Moñino <manuel.carrasco.m@gmail.com> | 2013-12-10 09:48:12 +0100 |
commit | 8f505c17946934d1e792e32b22903f0cc9ed7995 (patch) | |
tree | 9ab1170f4d8007bdb3ff077ad24fd618ed723c19 | |
parent | 9570540f3a3519c17388424eec280cef6d298a08 (diff) | |
download | gwtquery-8f505c17946934d1e792e32b22903f0cc9ed7995.tar.gz gwtquery-8f505c17946934d1e792e32b22903f0cc9ed7995.zip |
CSS3 animations where failing with "%" units, fixing it in the same way we do with non CSS3
-rwxr-xr-x | gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/TransitionsAnimation.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/TransitionsAnimation.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/TransitionsAnimation.java index 0bb7e1e3..c93e62bf 100755 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/TransitionsAnimation.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/effects/TransitionsAnimation.java @@ -148,16 +148,14 @@ public class TransitionsAnimation extends PropertiesAnimation { } else { MatchResult parts = REGEX_SYMBOL_NUMBER_UNIT.exec(val); if (parts != null) { - unit = REGEX_NON_PIXEL_ATTRS.test(key) || Transitions.transformRegex.test(key) ? "" : "px"; String part1 = parts.getGroup(1); String part2 = parts.getGroup(2); String part3 = parts.getGroup(3); trsEnd = "" + Double.parseDouble(part2); - if (unit.isEmpty() && part3 != null) { - unit = part3; - } + unit = REGEX_NON_PIXEL_ATTRS.test(key) ? "" : part3 == null || part3.isEmpty() ? "px" : part3; + if (trsStart.isEmpty()) { trsStart = key.matches("scale") ? "1" : "0"; } @@ -168,6 +166,17 @@ public class TransitionsAnimation extends PropertiesAnimation { double en = Double.parseDouble(trsEnd); trsEnd = "" + (st + (n*en)); } + + // Deal with non px units like "%" + if (!unit.isEmpty() && !"px".equals(unit) && trsStart.matches("\\d+")) { + double start = Double.parseDouble(trsStart); + double to = Double.parseDouble(trsEnd); + g.css(key, to + unit); + start = to * start / g.cur(key, true); + trsStart = start + unit; + g.css(key, start + unit); + } + } else { trsStart = ""; trsEnd = val; |