Ok, I was trying to submit the JIRA issue but I don't see any place to attach files, is that possible? I'm not familiar with the JIRA tracking system...

El 27/05/11 12:43, Greg Brown escribió:
OK, it would probably help if you could submit a JIRA issue with a small sample 
app that reproduces the problem.

On May 27, 2011, at 1:36 PM, Edgar Merino wrote:

I'm sorry, I was using System.out.println and not breakpoints. I increased the 
duration to 400, rate to 28 but it gets even worse, it seems like having a 
smaller duration helps a bit, but I can still reproduce the bug.

El 27/05/11 07:26, Greg Brown escribió:
Try using System.out() to log progress. If you set a breakpoint, your 
transition will almost certainly complete while you are stepping through code. 
Also try extending the transition duration since that will give you a larger 
data set.

On May 26, 2011, at 9:15 PM, Edgar Merino wrote:

Hello, I've been trying to fix a bug I just found using Transitions and 
ComponentMouseListeners. You can take, for example, the ScaleTransition I just 
submitted to the dev mailing list, although this should apply to any transition.

For this example, I'll use the ScaleTransition in a ComponentMouseListener, as 
follows:


import java.util.Arrays;
import java.util.Collection;
import org.apache.pivot.wtk.Component;
import org.apache.pivot.wtk.ComponentMouseListener;

public class ZoomComponentMouseListener implements ComponentMouseListener {

    private ScaleTransition scaleTransition = new ScaleTransition();

    public ZoomComponentMouseListener(Component targetComponent) {
        scaleTransition.addComponent(targetComponent);
    }

    public boolean mouseMove(Component component, int x, int y) {
        return false;
    }

    public void mouseOver(Component component) {
        if (scaleTransition.isRunning()) {
            scaleTransition.reverse();
        } else {
            scaleTransition.setReversed(false);
            scaleTransition.start();
        }
    }

    public void mouseOut(Component component) {
        if (scaleTransition.isRunning()) {
            scaleTransition.reverse();
        } else {
            scaleTransition.setReversed(true);
            scaleTransition.start();
        }
    }

    public void setZoom(float zoom) {
        scaleTransition.setZoom(zoom);
    }
}


When this listener is attached to a Component, like an ImageView for example, 
if you get through the ImageView quickly with the mouse pointer and then cross 
it again quickly, the method Transition#getPercentComplete will get screwed, 
the second time the transition is started getPercentComplete will report 1 when 
it should report 0. I've tested this many times, before calling 
Transition#start, getPercentComplete reports 0, when calling start and checking 
the value of getPercentComplete from the Transition#update method it reports 1.

I've got no clue on what's happening here, placing a breakpoint inside the 
Transition#start method reports currentTime - startTime == 0, but checking 
again when it gets to the Transition#update method currentTime - startTime == 1.

Perhaps I've anticipated on saying this is a bug for Transitions, perhaps is my 
code what's causing problems, but I just don't have a clue on how to fix this.

Please, if anybody's able to reproduce this, let me know so we can find a 
solution. I've attached the ScaleTransition here in case there are users not 
subscribed to the dev mailing list.

Thanks in advance!
Edgar Merino
<ScaleTransition.java>

Reply via email to