View Full Version : BaseEffect Move

15 Oct 2009, 5:45 AM
I've found a bug on provided Effects : (BaseEffect) :

- Detailed description of the problem
When i use a base effect like Move or SlideIn / SlideOut, sometimes effect completes, sometimes not :
Example :
Asking for a move to position (200,200), sometimes position is not reached

It was not easy to figure out why... But after sequencing a slideOut then SlideIn effect, my component wasnt at the same place...

- GXT version

- Host mode / web mode / both - Browser and version - Operating System
Both Hosted and web. For web, tested on Firefox on XP.

- Sample code
Examples taken from Explorer demo.

=== Reason, Workaround, Correction ===
The "Engine" which runs effects will try to call onUpdate() method at certain interval. However, sometimes browser is bussy : the method cannot be called at regular intervals.

=> Thats why the onUpdate(val) method takes a percentage of the total amount of time elapsed and not just a ticker.

The onComplete() method is supposed to :
a) ensure animation completed
b) cleanup things needed during animation.

that said :

a move effect can be called for :
10%, 34%, 68%, 79%... and thats all...

If the onComplete method just unwraps the element, the element is not where it is supposed to be...

Thats why the best practice, is to self-call onUpdate(1.0) as first statement in the onComplete() method.

==> Workaround :

You can Overide effects and do a final onUpdate(1.0) call at the beginning of the onComplete() method

==> Correction :
That should be corrected in BaseEffects : i suggest this to be the default implementation for the oncomplete method.


public void onComplete() {
el.setXY(toX, toY);

Sven : i've notted it for future.

15 Oct 2009, 5:46 AM
Please read the bugforum guidelines and update the reports. I moved this to the help forum for now.