I'm trying to create a sortable tree in which when I drop an element ender another one it will resort ender and when I drop it above it will be sorted above, and when it dropped on the element it will resort as a child element. I create the following formula, but it is no reliable because offset=the distance between mouse position and between the original position of the dragged object.
const box = draged.getBoundingClientRect()
const offset = e.clientY - box.top - (box.height / 2)
Top comments (1)
Solved