How to adjust drop zone to make dropping between nodes easier.
See original GitHub issueI’m having hard times sorting elements within the tree, especially correlating to my problem with performance of the drop zones showing up with a high latency described in issue #173.
I do have ideas on how to make sorting nodes within the same level easier, however have no idea on how to get started with this? And which way is the most promising one? Can anyone give me an hint?
-
Is it anyhow possible to adjust the drop zone sizes to make it easer to drop an node between to nodes of same size?
-
Can the drop zones between two nodes be extended to overlap the nodes?
-
Is it possible to “magnetically” jump to the next closest droppable drop-zone between to posts even though the course is not exactly over it? (eg. using allowDrop allows to only drop between nodes but not onto child nodes, thus the next magnetic drop zone would be befor or after the node the courser is currently on?
-
Increase the drop zones close the the items there the mouse is dragging an node over is close to. Eg. increase the drop zones before and after the item there the mouse is currently dragging over.
I’m thinking of a similar behavior like dragula has it for sorting list, just for the tree.
Background
I’m trying to sort elements within a tree. My nodes do have a fixed level according to their type. eg. root-category and sub-category. I’m using a simple allowDrop function to only allow to drop the sub-category onto any root-category or between two other sub-categories.
allowDrop: (d, t) => {
return (
( d.data.type=="sub" && t.parent.level==1 ) ||
( d.data.type=="root" && t.parent.level==0 )
);
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top GitHub Comments
@adrian-mitangi I’m looking into refactoring the DnD, but it’s quite a big task so I can’t give a specific deadline yet
Maybe this is a try with css. The idea is to increase the node-drop-slot like the mac os bottom menu bar. Then you hover an element the closest elements increase.
My first try was with a css hover effect. However :hover is not applied then an element is dragged 😕 also it only works for going down with mouse, since there is no css selector for before.
Thus I increased the drop zone with a negative margin over the nodes them selves. However this solutions is still a little bit flickery.
Maybe it makes sense to add the .is-dragging-over also to the .tree-node-leaf or even better an class
.is-tragging-over-next
to the previous tree-node-leaf? This would allow to increase the space ahead of the mouse coming close. Using css3 transitions would allow to make the increase smooth.what you guys think?