Gotlifebar / gwtquery-plugins

Automatically exported from code.google.com/p/gwtquery-plugins
0 stars 0 forks source link

Droppable parents of droppable and draggable stop receiving events when you drop somthing to child #47

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Every widget is draggable and droppable
2. Drag widget A into widget B
3. Try to drag widget B into parent who is draggable and droppable.
4. To better see the problem setDroppableHoverClass for droppable widgets.
5. Every widget has set greedy to true

What is the expected output? What do you see instead?
Expected is that parent of B widget should receive overDroppable event when you 
drag widget B over it. But it works only when you omit step 2.

What version of the product are you using? On what operating system?
Windows 7, gwtquery-1.2.0.jar, gquery-dnd-bundle-1.0.6.jar

Please provide any additional information below.

Original issue reported on code.google.com by gento...@gmail.com on 15 Jan 2013 at 8:39

GoogleCodeExporter commented 8 years ago
I have tried to fix drag function from DroppableHandler, for me it works now as 
I expect. Please look at it and compare to orginal. Let me now if this method 
is ok and if so please include these fix in next release:

    public void drag(Element droppable, Element draggable, GqEvent e) {
        if (options.isDisabled() || greedyChild || !visible) {
            return;
        }

        boolean isIntersect = intersect(draggable);
        PositionStatus c = null;

        if (!isIntersect && isOver) {
            c = PositionStatus.IS_OUT;
        } else if (isIntersect && !isOver) {
            c = PositionStatus.IS_OVER;
        }
        if (c == null) {
            return;
        }

        DroppableHandler parentDroppableHandler = null;
        GQuery droppableParents = $(droppable).parents(
                "." + Droppable.CssClassNames.GWTQUERY_DROPPABLE);
        if (options.isGreedy()) {
            // TODO maybe filter the parent with droppable data instead of test on css
            // class name
            for (int i = 0; i < droppableParents.length(); i++) {
                parentDroppableHandler = DroppableHandler.getInstance(droppableParents.get(i));
                parentDroppableHandler.greedyChild = (c == PositionStatus.IS_OVER);
            }
        }

        for (int i = 0; i < droppableParents.length(); i++) {
            parentDroppableHandler = DroppableHandler.getInstance(droppableParents.get(i));
            if (parentDroppableHandler != null && c == PositionStatus.IS_OVER) {
                parentDroppableHandler.isOver = false;
                parentDroppableHandler.isOut = true;
                parentDroppableHandler.out(droppableParents.get(i), draggable, e);
            }
        }

        if (c == PositionStatus.IS_OUT) {
            isOut = true;
            isOver = false;
            out(droppable, draggable, e);
        } else {
            isOver = true;
            isOut = false;
            over(droppable, draggable, e);
        }
            // This should be deleted:
//        if (droppableParents.length() > 0) {
//            parentDroppableHandler = 
DroppableHandler.getInstance(droppableParents.get(0));
//            if (parentDroppableHandler != null && c == PositionStatus.IS_OUT) 
{
//                parentDroppableHandler.isOut = false;
//                parentDroppableHandler.isOver = true;
//                parentDroppableHandler.over(droppableParents.get(0), 
draggable, e);
//            }
//        }
    }

Original comment by gento...@gmail.com on 17 Jan 2013 at 4:10