Wednesday, 6 November 2019

Horizontal ordered bin packing of svg elements

Trying to figure out the best way of bin packing/ distributing a bunch of known width svg images in a horizontal row, where they can be stacked on top of each other if the width of the container is too tight.

Height of container should optimally be self-adjusted, and the gravity should be the vertical center point. Created a few images to illustrate the desired solution.

Are there any JS library out there that solves this problem, d3 perhaps? It feels like a bin packing problem, but perhaps with some added complexity for order and gravity. Not interested in canvas solutions.

If container is wide enough

Too tight, stack some elements

Even tighter, stack all



from Horizontal ordered bin packing of svg elements

No comments:

Post a Comment