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 )
to reproduce: http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/tree/test_Tree_DnD.html
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.
Reason:
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
Milestone: | tbd → 1.4 |
---|---|
Owner: | set to bill |
comment:2 Changed 11 years ago by
Milestone: | 1.4 → 1.5 |
---|
comment:3 Changed 11 years ago by
Milestone: | 1.5 → 1.6 |
---|
comment:4 Changed 10 years ago by
Description: | modified (diff) |
---|---|
Milestone: | 1.6 → future |
Summary: | tree drag and drop is defect if you drop outside a node → Tree: drag and drop is defect if you drop outside a node |
comment:5 Changed 9 years ago by
Milestone: | future → 1.4 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
@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].
I do see that error, with a "node is null" exception in the console. I'll try to fix for 1.4.