chris-l / bin-packing-grid

Web component that fit elements into a grid using bin-packing, in a masonry-like way. Similar to what pinterest and other sites have
http://chris-l.github.io/bin-packing-grid/
122 stars 9 forks source link

Drag and Drop Suggestion #2

Open eggers opened 9 years ago

eggers commented 9 years ago

Great demo, very cool.

I was just thinking that it would be interesting to do a drag and drop feature. Where you grab one block and can decide where to place it. The others would flip away to make space, and then find their own space when you dropped the block.

chris-l commented 9 years ago

That would be cool, but the problem is that this module is about using the bin-packing algorithm to reorder the elements to leave the minimum amount of gaps.

So, while is true that it uses the initial order of the dom elements as start, the end position of each element is determined by the algorithm and not by the actual order of the elements, and therefore the user cannot alter the end position.