Description
I am using the Vue.Draggable binding for SortableJS to build a draggable tree structure.
I built the tree and DnD works just fine. Now I want to implement nesting a node by dragging it horizontally to the right, under the node that I want to nest it into.
Here is my question about that on Stackoverflow (the Vue.Draggable dev requires such questions to be asked on Stackoverflow but I still haven't received any answer there). So I ask here since I believe that if that feature would be supported by SortableJS then it would also work in Vue.Draggable.
What would be the approach with Vue.Draggable/SortableJS in order to achieve the functionality as shown in this animated gif?
The default behavior of Sortable for nesting is to drag the element up to the above element until the mouse reaches
emptyInsertThreshold
pixels from the drop zone of the above element but I would like to be able to nest elements by dragging them to the right. Same for un-nesting.I have set
emptyInsertThreshold
to0
to disable the default behavior and now when I drag the element to the right I get the following events fired:clone
andstart
(in that order).But how do I:
- Can get notified when the mouse has traveled the pre-defined distance to the right?
- Inform Vue.Draggable that the ghost element should be nested as a child to the element under which I am doing the horizontal movement?