gevorg-kopalyan / java-universal-tween-engine

Automatically exported from code.google.com/p/java-universal-tween-engine
0 stars 0 forks source link

BaseTween not passing reference to itself in the call back call. #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Tween with a an associated COMPLETE callback.
2. Run the tween and breakpoint the callback method "onEvent"
3. The onEvent parameter "BaseTween source" is always null.

What is the expected output? What do you see instead?

I would expect to see the BaseTween source reference.

What version of the product are you using? On what operating system?

Version 6.0.0

Please provide any additional information below.

The call method "callCallbacks" in the BaseTween class should pass "this" as a 
parameter instead of null i.e.

protected void callCallbacks(EventType type) {
        List<TweenCallback> callbacks = null;

        switch (type) {
            case BEGIN: callbacks = beginCallbacks; break;
            case START: callbacks = startCallbacks; break;
            case END: callbacks = endCallbacks; break;
            case COMPLETE: callbacks = completeCallbacks; break;
            case BACK_START: callbacks = backStartCallbacks; break;
            case BACK_END: callbacks = backEndCallbacks; break;
            case BACK_COMPLETE: callbacks = backCompleteCallbacks; break;
        }

        if (callbacks != null && !callbacks.isEmpty())
            for (int i=0, n=callbacks.size(); i<n; i++)
                callbacks.get(i).onEvent(type, null);
    }

Original issue reported on code.google.com by alistair.rutherford on 1 Feb 2012 at 4:19

GoogleCodeExporter commented 9 years ago
Sorry the code change is this:

protected void callCallbacks(EventType type) {
        List<TweenCallback> callbacks = null;

        switch (type) {
            case BEGIN: callbacks = beginCallbacks; break;
            case START: callbacks = startCallbacks; break;
            case END: callbacks = endCallbacks; break;
            case COMPLETE: callbacks = completeCallbacks; break;
            case BACK_START: callbacks = backStartCallbacks; break;
            case BACK_END: callbacks = backEndCallbacks; break;
            case BACK_COMPLETE: callbacks = backCompleteCallbacks; break;
        }

        if (callbacks != null && !callbacks.isEmpty())
            for (int i=0, n=callbacks.size(); i<n; i++)
                callbacks.get(i).onEvent(type, this); /* HERE */
    }

Original comment by alistair.rutherford on 1 Feb 2012 at 4:20

GoogleCodeExporter commented 9 years ago
Hello, sorry about the late reply.
The issue was fixed in revision a7de6d2ccf4a.

http://code.google.com/p/java-universal-tween-engine/source/detail?r=a7de6d2ccf4
afcf726ad4736beefd90c3087415a

This revision will be part of 6.1.0, not yet released. It should however come 
very soon. Since then, you can download the latest sources by cloning the 
repository :)

Original comment by aurelien.ribon on 8 Feb 2012 at 1:49