Opened 12 years ago

Closed 9 years ago

#9475 closed defect (fixed)

Tree: drag and drop is defect if you drop outside a node

Reported by: petschm Owned by: bill
Priority: high Milestone: 1.4
Component: Dijit Version: 1.3.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

to reproduce:

Start dragging a child of the "Foods" node on the right tree. Move the item above the "Foods" node but don't cross the border of the tree and finally drop it. The child disappears.


If you leave the "Foods" node the tree triggers onNodeMouseLeave which is connected to onMouseOut in dndSource, onMouseOut calls unmarkTargetAnchor which sets targetAnchor to null. The drop will fail with targetAnchor set to null.
On the left tree betweenThreshold is set to 5 to enable a drop between two nodes. With betweenThreshold set, onMouseMove calls _onDragMouse which adjusts the canDrop flag. So canDrop is set to false if you leave a node.

I see several solutions for this problem:

  • First of all onDndDrop should just call onDndCancel if targetAnchor is null, this solves also #7971
  • You could call onDragMouse on every mouse movement not only when betweenThreshold is set. I think this was the case in a the previous version, why was it removed? performance gain?
  • A simple solution is to just set canDrop to false in onMouseOut.
  • Or call onDragMouse in onMouseOut

Change History (5)

comment:1 Changed 11 years ago by bill

Milestone: tbd1.4
Owner: set to bill

I do see that error, with a "node is null" exception in the console. I'll try to fix for 1.4.

comment:2 Changed 11 years ago by bill

Milestone: 1.41.5

comment:3 Changed 11 years ago by Adam Peller

Milestone: 1.51.6

comment:4 Changed 10 years ago by bill

Description: modified (diff)
Milestone: 1.6future
Summary: tree drag and drop is defect if you drop outside a nodeTree: drag and drop is defect if you drop outside a node

comment:5 Changed 9 years ago by bill

Milestone: future1.4
Resolution: fixed
Status: newclosed

@petschm - You are right... the onMouseMove() solution (your second suggestion) was reintroduced in 1.4, essentially fixing this problem, and I also just implemented your first suggestion in [28025].

Note: See TracTickets for help on using tickets.