Comments (9)
I agree that the drop should not occur in this case due to the drop visually
occurring on area A which is not a drop target.
This is, however, very difficult in practice to handle for the generic case. I
do
have a workaround for you, which is to register A as a drop target, but simply
throw
a VetoDragException when one drops on A. This will cause the widget to jump
back to
the original location. The drop will not be allowed.
Original comment by fredsa
on 14 Dec 2007 at 4:05
- Changed state: Accepted
from gwt-dnd.
It won't work (in my case).
I draw (see attachment) 2 divs (A&B), drag proxy with move-line and drop point.
Original comment by [email protected]
on 14 Dec 2007 at 8:02
Attachments:
from gwt-dnd.
The problem here is that in GWT 1.4 Arrays.sort is unstable (see GWT issue 1583,
http://code.google.com/p/google-web-toolkit/issues/detail?id=1583) in web mode,
so
that the results are inconsistent. In hosted mode you should be able to see the
correct behavior by registering the drop controllers in the correct order (see
below).
Here's the idea:
class VetoAbsolutePositionDropController extends AbsolutePositionDropController {
public VetoAbsolutePositionDropController(AbsolutePanel dropTarget) {
super(dropTarget);
}
public void onPreviewDrop(DragContext context) throws VetoDragException {
throw new VetoDragException();
}
}
public void onModuleLoad() {
// make sure document is big enough so we can drag around on the root panel
DOM.setStyleAttribute(RootPanel.getBodyElement(), "height", "500px");
AbsolutePanel a = new AbsolutePanel();
a.setPixelSize(200, 200);
DOM.setStyleAttribute(a.getElement(), "backgroundColor", "blue");
AbsolutePanel b = new AbsolutePanel();
b.setPixelSize(200, 200);
DOM.setStyleAttribute(b.getElement(), "backgroundColor", "gray");
Label draggable = new Label("draggable");
DOM.setStyleAttribute(draggable.getElement(), "backgroundColor", "green");
// The order in which you attach A and B,
// and their CSS z-index attributes will determine
// the visual stacking; However, this does not
// (currently) affect the order in which drop targets
// are considerd. See the registerDropController calls below.
// A should partially cover B, so add A second
RootPanel.get().add(b, 0, 0);
RootPanel.get().add(a, 50, 50);
RootPanel.get().add(draggable, 200, 10);
PickupDragController dragController = new PickupDragController(RootPanel.get(),
true);
dragController.makeDraggable(draggable);
// Cannot drop on A, use VetoAbsolutePositionDropController
AbsolutePositionDropController dropControllerA = new
VetoAbsolutePositionDropController(a);
// Dropping on B is fine
AbsolutePositionDropController dropControllerB = new
AbsolutePositionDropController(b);
// The order in which you register drop controllers is important
// Register A first to have A considered before B
// This works in hosted mode, but is inconsistent in web mode
// due to unstable sort (GWT issue 1583)
dragController.registerDropController(dropControllerA);
dragController.registerDropController(dropControllerB);
}
Are you able to use GWT 1.5 (built from the GWT sources), or would you be able
to use
a patched version of GWT 1.4 to work-around this issue?
Original comment by fredsa
on 14 Dec 2007 at 4:45
- Added labels: Milestone-GWT-1.5
from gwt-dnd.
Original comment by fredsa
on 14 Dec 2007 at 4:46
- Changed title: Problem with overlapping drop targets in web mode
from gwt-dnd.
We're using GWT 1.4 and probablby we'll use GWT 1.5 (but a stable build)
Original comment by [email protected]
on 17 Dec 2007 at 11:40
from gwt-dnd.
If you have a chance, please try gwt-dnd 2.0.7 of later with GWT 1.5. You may
find
the situation sufficiently improved.
Original comment by fredsa
on 19 Jan 2008 at 10:51
from gwt-dnd.
See
http://groups.google.com/group/gwt-dnd/browse_thread/thread/a9bccb59b6a10604 for
some hints in this area
Original comment by fredsa
on 15 Feb 2008 at 3:26
from gwt-dnd.
http://code.google.com/p/google-web-toolkit/issues/detail?id=1583 seems to be
fixed
Original comment by [email protected]
on 4 Aug 2011 at 9:21
from gwt-dnd.
Original comment by [email protected]
on 5 Aug 2011 at 12:48
- Changed state: Fixed
from gwt-dnd.
Related Issues (20)
- gwt-dnd-3.2.3 not works on gwt 2.6 HOT 1
- Children widgets of drag handle also handle mouse down event. HOT 1
- Forcing IE6 / IE7 permutation using extend-property tag causes compilation error HOT 3
- When scaling the body with CSS, the mouseX and mouseY calculations are wrong. HOT 1
- Rebind result 'com.allen_sauer.gwt.dnd.client.util.impl.DOMUtilImpl' cannot be abstract HOT 2
- VerticalPanelDropController index of Positioner is alway -1
- IE loading css problem
- Patch for /DragDrop/src/com/allen_sauer/gwt/dnd/client/util/gwt-dnd.css HOT 1
- Warning rebinding DragClientBundle - encountered '=' was expecting... HOT 3
- Warning when parsing CSS HOT 2
- on chrome on Linux the page gets selected on drag
- while dragging, the droppable location is not inserted. HOT 1
- GWT DnD Demo is not working properly on Android 5.1
- Error in AbstractInsertPanelDropController
- Pushing a new version to Maven
- Drag & Drop of <div> elements inside a text area or contenteditable HOT 1
- NPE in PickupDragController.dragEnd() with null context.dropController
- Unable to parse JavaScript GWT 2.7.0
- Rebinding com.allen_sauer.gwt.dnd.client.util.DragClientBundle Warning
- Chrome drag end event cancelled
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gwt-dnd.