Open GoogleCodeExporter opened 9 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
Original issue reported on code.google.com by
gento...@gmail.com
on 15 Jan 2013 at 8:39