packery icon indicating copy to clipboard operation
packery copied to clipboard

center-out layout algorithm

Open desandro opened this issue 11 years ago • 17 comments

@metafizzyco would packery work placing items outwards from the centre rather than from the top left? have you tried it (or seen it tried)?

– @noii

I've been thinking about this and I think I can pull it off.

Currently the algorithm works by sorting the available spaces by the closest to the top left corner. Switching corners is easy enough.

In order to support a layout where there's is a fixed point, and stuff is laid-out around it would work by sorting spaces based on their distance from the 'center point'.

desandro avatar Jun 26 '13 20:06 desandro

+1 wants this

pyronaur avatar Jul 16 '13 11:07 pyronaur

+1

Skaidon avatar Jul 23 '13 18:07 Skaidon

Would be so useful for one of my projets !

jide avatar Aug 18 '13 21:08 jide

This would be great! Any progress or idea on how to implement it ?

alevals avatar Sep 23 '13 16:09 alevals

+1

thecoleorton avatar Dec 11 '13 20:12 thecoleorton

+1

jbravar avatar Dec 16 '13 20:12 jbravar

:+1:

loginx avatar Dec 20 '13 16:12 loginx

Any update on this? My attempts on doing something similar has created WAY too many edge cases...

Thanks in advance!

thecoleorton avatar Jan 16 '14 20:01 thecoleorton

In the works.

Packery center out

Development is on the center-out-corner branch. It's in an experimental phase. While this is a neat visual demo, I'm unsure how practical its application is.

desandro avatar Jan 28 '14 03:01 desandro

For what it's worth, I came across this issue while developing a site where the designer wanted to have a layout with items expanding infinitely in every direction. Didn't end up implementing it that way, but I thought it was an interesting idea.

jbravar avatar Jan 28 '14 04:01 jbravar

Curious as to the status of this branch, and whether it will get integrated into Packery itself... ?

dhowe avatar Jan 17 '15 17:01 dhowe

This branch is still an experiment and will likely continue to be so. It's a neat feature, but I don't think it has enough popularity to build into Packery.

desandro avatar Jan 17 '15 20:01 desandro

I see -- any reason why events would not work as usual on this branch? (see issue #235)

dhowe avatar Jan 18 '15 04:01 dhowe

The center-out-corner branch is experimental. Things are likely to break. Sorry, but I won't be able to devote time to look in to broken events.

desandro avatar Jan 18 '15 15:01 desandro

+1

streiten avatar Jun 17 '15 09:06 streiten

Very nice, Desandro. Just what we are looking for. How painful would it be to make this hierarchical? This would be far more space-efficient than regular circle packing. (See D3 Bostock/Heer example with circle packing, at http://bl.ocks.org/mbostock/4063530.) I'm worried that what you'd end up with is a lot of space unless you had some fill flex in the parent as well as (perhaps) the possibility of a nonrectangular polygon as the parent. That's the only way to make it very space efficient.

pzelchenko avatar Nov 05 '15 00:11 pzelchenko

@desandro This actually works really great. I'm adopting this "center-out" algorithm implementation for a commercial product I'm working on. While we're not using packery code directly at the moment, I'm still buying an 8 pack of developer licenses to support the project. Thank you!

workmanw avatar Mar 31 '17 01:03 workmanw