google-code-export / gwt-dnd

Automatically exported from code.google.com/p/gwt-dnd
0 stars 0 forks source link

GridConstrainedDropController doesn't constrain to grid when dropping partially outside of the target #140

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Does the issue occur in "quirks mode", "standards mode" or both? If you don't 
know, does your HTML page contains a DOCTYPE declaration?

Standard

What version of GWT are you using? 1.4.60? 2.0.4? Other?
2.2

What version of the gwt-dnd jar file or library file are you using?
3.1.0

What operating system(s) are you using? Windows? Linux? Mac?
Windows 7

Does the issue occur in web mode, development mode (formerly "hosted
mode"), both or don't know?
Both

What browser(s) do you use? Chrome, Firefox, IE, Safari, other?
Chrome

What is the browser version (if you know) from Help->About?
11.0.672.2 dev

What steps will reproduce the problem? Please attach sample code if you can.
1. Use GridConstrainedDropController 
2. Drag to a position that is (partially) off the top of the target panel that 
is between grid lines.
3. Release

What is the expected output? What do you see instead?
It would snap to the grid. Instead it snaps to the grid in y but not x. Works 
fine when dropped anywhere inside the panel.

See for example http://web-expresser.appspot.com/ (Source code at 
http://code.google.com/p/migen/source/browse/#svn%2Ftrunk%2Fweb-expresser)

Do you have a workaround?
No.

Please provide any additional information below.

Original issue reported on code.google.com by ToonT...@gmail.com on 20 Feb 2011 at 6:18

GoogleCodeExporter commented 9 years ago
You code contains:
  dragController = new PickupDragController(this, true);

which allows dropping on the boundary panel.

I think this will fix it:
  dragController = new PickupDragController(this, false);

Original comment by fredsa@google.com on 23 Feb 2011 at 8:53

GoogleCodeExporter commented 9 years ago
Of course, thanks for the detailed use case on App Engine, and a link to the 
source code. That made it super easy for me to look at and diagnose!

Do let me know if the solution does not work for you.

THANKS

Original comment by fredsa@google.com on 23 Feb 2011 at 8:53

GoogleCodeExporter commented 9 years ago
Thanks for the speedy response.

The problem is that I do want to restrict the dropping to the boundary panel 
but it isn't restricting it properly when the widget is dragged completely off 
the boundary panel.

ok.png - works fine where the widget is dropped when partially outside of the 
boundary panel.

In not_ok1.png I am about to drop it completely above the boundary panel. In 
not_ok2.png you can see that it ends up with the correct y coordinate but the x 
coordinate isn't constrained to the grid.

When I tried your suggestion of changing true to false then when I dropped it 
outside it ended up where it was at the start of the drag which isn't 
desirable. Where it currently ends up is fine if was constrained to the nearest 
grid location in both coordinates.

Original comment by ToonT...@gmail.com on 25 Feb 2011 at 8:44

Attachments:

GoogleCodeExporter commented 9 years ago
The second argument to the PickupDragController constructor is 
allowDroppingOnBoundaryPanel, so you want that to be false.

I think want you want to call is
 setBehaviorConstrainedToBoundaryPanel(true)

Original comment by fredsa@google.com on 9 Mar 2011 at 1:57

GoogleCodeExporter commented 9 years ago
When I change it to false and attempt to drag a widget beyond the boundary 
panel then the widget stops at the border (good) but if the mouse is outside of 
the boundary panel when the mouse button is released then the widget ends up 
going back to where it last was. I want it to snap to the grid just inside the 
border of the boundary panel (as it almost always does when 
allowDroppingOnBoundaryPanel is true). It seems to me that 
GridConstrainedSelectionStyleDropController isn't working right when the mouse 
button is released outside the panel. The drop is constrained to the grid in 
only one dimension.

Original comment by ToonT...@gmail.com on 9 Mar 2011 at 9:15

GoogleCodeExporter commented 9 years ago
Any news on this? Its still not working as intended

Original comment by l...@simplefitness.dk on 18 Aug 2011 at 8:31