fredsa / gwt-dnd

Library providing easy to use mouse or touch based drag-and-drop capabilities to GWT
42 stars 41 forks source link

If getBehaviorDragStartSensitivity() > 0 first MouseDragHandler.onMouseMove() call handles sensitivity value incorrectly #135

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

if getBehaviorDragStartSensitivity() > 0 then drageMove() method is called on 
mouseMove event (even if sensitivity isn't exceeded) with incorrect 
context.mouseX/Y values. Therefore there are some flickering side-effects.

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

There should be a respect of DragStartSensitivity value on mouse move event.

Do you have a workaround?

MouseDragHandler#onMouseMove method has incorrect relative coordinates during 
first call. Coordinates are relative to the "capturingWidget" (actual 
event.sender()) but are not relative to the "mouseDownWidget". 
Relative coordinates should be calculated relative to "mouseDownWidget"

 Widget sender = (Widget) event.getSource();
    Element elem = sender.getElement();
    // TODO optimize for the fact that elem is at (0,0)
    int x = event.getRelativeX(elem);
    int y = event.getRelativeY(elem);

should be replaced with 

    Element elem = mouseDownWidget.getElement();
    // TODO optimize for the fact that elem is at (0,0)
    int x = event.getRelativeX(elem);
    int y = event.getRelativeY(elem);

Assuming that there is need to review whole logic according to this issue due 
to regular mouseMove event is handled properly

Original issue reported on code.google.com by aanto...@eclipse-sp.com on 8 Dec 2010 at 12:13

GoogleCodeExporter commented 9 years ago
GWT 2.0.3
GWT-DND r1030

I've found the fix in GWT-DND r1057 but it is required me to upgrade to GWT 2.1 
version

Original comment by aanto...@eclipse-sp.com on 8 Dec 2010 at 12:43

GoogleCodeExporter commented 9 years ago
Thanks for reporting the issue and providing a detailed fix. I'm glad you were 
able to upgrade to the latest version which already has a fix for this.

Original comment by fredsa@google.com on 9 Dec 2010 at 8:51