Good question.
First you need to create a list of the following data for each dragged file:
- Position X
- Y position
- Height
- Width
When defining objects as draggable objects, you can bind the callback to the drag event. This event fires when the dragged item moves 1 pixel. The value of this callback will be called a lot, so it is the key to keep the calculations minimal.
When the callback is called, you will be supplied with ui and event objects. The ui object will contain valuable positioning data X and Y on draggee.
With the size and location of the drag and other draggable objects, you can easily calculate the proximity to your siblings and act accordingly. With the available data, you can implement akellehe math.
Before I forget, you will have to recount the list of positions on the drag-and-drop stop event.
Edit: Check out the following draggable link for documentation on draggable events, methods, and values.
source share