supraniti / Lean-Mean-Drag-and-Drop

Drag&Drop Sorting and Reordering script for complex nested structures
https://supraniti.github.io/Lean-Mean-Drag-and-Drop/
MIT License
117 stars 25 forks source link

Reordering elements is too precise #4

Open adam-lynch opened 7 years ago

adam-lynch commented 7 years ago

When trying to reorder elements, it feels a little difficult / the space I need to drag the element to is too small. I could be wrong but it seems like it won't reorder until the middle of the element being dragged passes the end of the sibling, whereas alternative libraries seem to reorder when the middle of the element being dragged passes the middle of the sibling.

I guess this would be particularly annoying with longer elements.

supraniti commented 7 years ago

The logic implemented in the positioning algorithm is as follows: If cursor location is above or left the element top-left point, the dragged element will be placed before it. I am wondering what do you think should happen on the following example - when you drag the blue item over points 1-12, when you drag the black item over points 1-12 lmdd

adam-lynch commented 7 years ago

If cursor location is above or left the element top-left point, the dragged element will be placed before it.

If I understand this correctly, I think it should be:

- If cursor location is above or left the element top-left point, the dragged element will be placed before it.
+ If cursor location is above or left the element center point, the dragged element will be placed before it.

I am wondering what do you think should happen on the following example - when you drag the blue item over points 1-12,

Hmmmm, when I created this issue, I was thinking of vertical reordering. I find it a bit hard to think about dragging in this grid-like layout but hmmm... I think:

when you drag the black item over points 1-12

Same as above;

Pravin-Parkhi commented 6 years ago

@supraniti

If cursor location is above or left the element top-left point, the dragged element will be placed before it.

This makes sense when we drag an element downward. But shouldn't we consider bottom left while dragging upward.

When movement is

  1. Top to bottom - top left
  2. Bottom to top - bottom left
  3. Left to right - top left
  4. Right to left - bottom right
supraniti commented 6 years ago

that's an interesting direction... and can be implemented with a little effort... i will dig into it