icholy/masonry — pull request #1 by ErisDS (2013-02-17 21:36:05+00:00)
Title: Drag & drop behaviour improvements

Loving the integration of drag and drop! Found that the drop behaviour seemed a little bit inconsistent and unintuitive at times with bricks landing in a different place depending on subtle drop positions, so I have tried to improve it. These commits may be a bit use-case specific / personal taste but in my opinion the behaviour seems better when using the top left corner of a brick as its "point" for calculating distance instead of the center, as at the very least a left-to-right user is more likely to position the left hand edge (perhaps this should be reversed if isRTL is set to true). Also setting the closest.index to be the index of the closest / hovered-over brick unless the user is dropping the brick to the right hand side. This is instead of checking to see if the center of one brick is to the left or right of the center of another brick which is quite subtle and gets confusing when bricks are different sizes.