I am using a DragRepositionStopHandler on a label. I get the event when the label is dragged and after it is placed (control is received at the end of the drag). event.source is still having the old position. getX and Y are the absolute mouse location at the time of drag end.
How do I find the final location (left, top) of the event.source? Am I using the wrong handler?
Is there a document about various dnd operations, events and handlers?
I couldn’t find an event that gets fired after the drag is completed. However, I found a workaround for the problem at hand. Placing my solution here, in case someone is looking for it.
Implement DragRepositionStartHandler and DragRepositionStopHandler
In DragRepositionStartHandler preserve getX & Y in class variable, say oldX and oldY
In DragRepositionStopHandler subtract current getX with oldX to get the displacement in x axis. Add this displacement to source.getLeft() and that would be the new left position of the component. Same goes for Y numbers.