Skip to content
This repository has been archived by the owner on Dec 8, 2017. It is now read-only.

Problem with overlapping drop targets in web mode #19

Closed
GoogleCodeExporter opened this issue Mar 13, 2015 · 9 comments
Closed

Problem with overlapping drop targets in web mode #19

GoogleCodeExporter opened this issue Mar 13, 2015 · 9 comments

Comments

@GoogleCodeExporter
Copy link

GWT: 1.4.60
gwt-dnd: 1.2.6

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

Does the issue occur in web mode, hosted mode, both or don't know?
Web mode

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

What is the browser version (if you know) from Help->About?
1.8.1.9 and 1.8.1.11

We have 2 div's (div B is under div A, div A partially covering out div B,
div B is registered as a dropTarget in (dropController)). When we move
draggable element into collaborative area (of div A and div B) and we drop
it in this area onDrop will be executed (on div B). 
I think in this situations it shouldn't be executed. 
You can check it using DialogBoxes. Try to cover up dropTarget (using
DialogBox) and then try to drop element on collaborative area
(dropTarget&DialogBox).

Original issue reported on code.google.com by duzakro...@gmail.com on 5 Dec 2007 at 12:14

@GoogleCodeExporter
Copy link
Author

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

@GoogleCodeExporter
Copy link
Author

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 artur.sz...@gmail.com on 14 Dec 2007 at 8:02

Attachments:

@GoogleCodeExporter
Copy link
Author

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

@GoogleCodeExporter
Copy link
Author

Original comment by fredsa on 14 Dec 2007 at 4:46

  • Changed title: Problem with overlapping drop targets in web mode

@GoogleCodeExporter
Copy link
Author

We're using GWT 1.4 and probablby we'll use GWT 1.5 (but a stable build)

Original comment by artur.sz...@gmail.com on 17 Dec 2007 at 11:40

@GoogleCodeExporter
Copy link
Author

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

@GoogleCodeExporter
Copy link
Author

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

@GoogleCodeExporter
Copy link
Author

http://code.google.com/p/google-web-toolkit/issues/detail?id=1583 seems to be 
fixed

Original comment by a.vol...@gmail.com on 4 Aug 2011 at 9:21

@GoogleCodeExporter
Copy link
Author

Original comment by fredsa@google.com on 5 Aug 2011 at 12:48

  • Changed state: Fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant