question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to adjust drop zone to make dropping between nodes easier.

See original GitHub issue

I’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?

  1. Is it anyhow possible to adjust the drop zone sizes to make it easer to drop an node between to nodes of same size?

  2. Can the drop zones between two nodes be extended to overlap the nodes?

  3. 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?

  4. 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
adamkleingitcommented, Jun 10, 2017

@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

2reactions
manuelfinkcommented, Feb 13, 2017

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.

treenode:hover > div > treenodedropslot > div.node-drop-slot {
    background: red;
    min-height: 20px;
}

Thus I increased the drop zone with a negative margin over the nodes them selves. However this solutions is still a little bit flickery.

.node-drop-slot {
  position: relative;
  /*background: red;*/
  /* padding: 8px 0;*/
  height: 12px !important;
  margin: -6px 0;
  z-index: 1000;
}
.node-drop-slot.is-dragging-over {
  /*height:30px !important;*/
  margin:0;
  height: 24px !important;
  /*background-color: blue !important;*/
}

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to adjust drop zone to make dropping between nodes ...
Increase the drop zones close the the items there the mouse is dragging an node over is close to. Eg. increase the drop...
Read more >
Drop Zone - Lightning Design System
Drag Over Drop Zone#. When dragging a component, use the drag over drop zone to indicate to the user where the component will...
Read more >
Create drop zones in Motion - Apple Support
In Motion, choose Object > New Drop Zone or press Shift-Command-D. A drop zone layer is added to the project. · Position and...
Read more >
drag and drop zone with child nodes - Stack Overflow
I have a drag and drop zone with multiple child nodes. The main element has dropenter and dropleave events. But if you drag...
Read more >
Row Dragging to an External DropZone - JavaScript Data Grid
Row Dragging to an External DropZone is concerned with moving rows from the grid to different components within the same application.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found