From 8f505c17946934d1e792e32b22903f0cc9ed7995 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20Carrasco=20Mo=C3=B1ino?= Date: Tue, 10 Dec 2013 09:48:12 +0100 Subject: [PATCH] CSS3 animations where failing with "%" units, fixing it in the same way we do with non CSS3 --- .../plugins/effects/TransitionsAnimation.java | 17 +++++++++++++---- 1 file 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; -- 2.39.5