ArcBees / gwtquery

A jQuery clone for GWT, and much more.
MIT License
85 stars 38 forks source link

NumberFormatException when using plus or minus in position animation #274

Closed ali-jalaal closed 10 years ago

ali-jalaal commented 10 years ago

Hi there,

I have a problem with gwtquery-1.4.0 (with gwt-user-2.5.1.jar). When I using animate() method by plus or minus operator before values like this:

$(this).animate("top:'+=30px'", 100, EasingCurve.swing);

I will get this:

java.lang.NumberFormatException: For input string: "282px" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1241) at java.lang.Double.parseDouble(Double.java:540) at com.google.gwt.query.client.plugins.effects.TransitionsAnimation.computeFxProp(TransitionsAnimation.java:165) at com.google.gwt.query.client.plugins.effects.TransitionsAnimation.onStart(TransitionsAnimation.java:222) at com.google.gwt.query.client.plugins.effects.TransitionsAnimation$TransitionsClipAnimation.onStart(TransitionsAnimation.java:78) at com.google.gwt.query.client.plugins.effects.TransitionsAnimation.run(TransitionsAnimation.java:243) at com.google.gwt.query.client.plugins.Effects.animate(Effects.java:179) at com.google.gwt.query.client.GQuery.animate(GQuery.java:1040)

Also I tries for example paddingLeft and I got same error (it isn't just for 'top' or 'left' property). It seems that in TransitionsAnimation.computeFxProp(), 'trsStart' variable should be refined and unit (like 'px') should be removed from it.

Thanks, Ali

ali-jalaal commented 10 years ago

Hi again,

Thanks for quick response. After upgrading to gwtquery-1.4.1.jar, transition animations (like what mentioned above) do not work. I called this method on a DialogBox object. It seems that more tests should be done on transition animations.

Regards

manolo commented 10 years ago

What is the error now? it should not raise a numberformat exception. Does it works if you set Fx.css3=false ?

ali-jalaal commented 10 years ago

There was no error but animation didn't work. But after adding Fx.css3=false; , it works! Is it enough to call above statement once for whole project? I mean that this property may be changed from inside of gwtquery classes? Thanks.

manolo commented 10 years ago

Yes if you call it once, your project does not use css3 transitions.

Although gquery does a good work trying to support old animation syntax to use css3 transitions instead of loop timers, some cases are not easy to face, specially those where initial values are not specifically set.

ali-jalaal commented 10 years ago

Thank you very much.