DrawLine not redrawn on event trigger

SmartGWT version 3.0

Test code below. I intend to draw a connecting line between two draggable images. The line should be updated after dragging. The problem I’m having is that the event is being triggered (I tested this with some print statements), but the line is not being redrawn until the next event. The result is that the line is always one step behind.
How can I make it so that the line is redrawn immediately after dragging the image?

Thanks!

public class TestDrawPane extends Canvas{
	
	final DrawPane drawPane;
	final DragPiece img;
	final DropPanel dropPanel1;
	final DropPanel dropPanel2; 
	  
    public TestDrawPane() {  
    	
    	setWidth("100%");
    	setHeight("100%");
    	setShowEdges(true);  
        setEdgeSize(3);
        
        drawPane = new DrawPane();
        drawPane.setWidth("100%");
        drawPane.setHeight("100%");
        drawPane.draw();
               
        final Img img2 = new Img("image2.png", 48, 48);
        final Img img3 = new Img("image3.png", 48, 48);
        
        img2.setLeft(200);
        img3.setLeft(400);

        img2.setCanDragReposition(true);
        img3.setCanDragReposition(true);

        img2.setCanDrop(true);
        img3.setCanDrop(true);

        drawPane.addChild(img2);  
        drawPane.addChild(img3);  
        
        addChild(drawPane);
        
        drawLines(img2, img3);
        
        drawPane.addDragRepositionStopHandler(new DragRepositionStopHandler() {

	        @Override
		public void onDragRepositionStop(DragRepositionStopEvent event) {
			drawLines(img2, img3);
		}
      	
        });
    }
    
    private void drawLines(Img w1, Img w2) {  
        drawPane.erase();  

          
        LineCap lineCap = LineCap.SQUARE;  
          
        LinePattern linePattern = LinePattern.SOLID;  

        DrawLine drawLinePath = new DrawLine();  
        drawLinePath.setDrawPane(drawPane);  
        drawLinePath.setStartTop(w1.getTop() + (w1.getHeight()/2));  
        drawLinePath.setStartLeft(w1.getLeft() + w1.getWidth() - 5);  
        drawLinePath.setEndLeft(w2.getLeft());  
        drawLinePath.setEndTop(w2.getTop() + (w2.getHeight()/2));  
        
        drawLinePath.setLineCap(lineCap);  
        drawLinePath.setLinePattern(linePattern); 
        
        drawLinePath.draw();  
    }  
       
}

So I figured it out myself. I was doing a couple things wrong.

First, instead of using the DragRepositionStopHandler, I used the MovedHandler.

For some reason, when the DragRepositionStopHandler fires, the positions (getLeft(), getTop(), etc.) for the widget that it’s attached to are not updated to the new widget position.

With the MovedHandler, the new widget position is reflected accurately.

My other mistake was just a dumb error on my part. I had associated the handler with the parent and not the actual widget that was being “handled”.

Sample handler code (replacing handler in my previous code above):

img3.addMovedHandler(new MovedHandler() {
        	
	@Override
	public void onMoved(MovedEvent event) {
		drawLines(img2, img3);
	}
	
});