Glebcha
Glebcha

Reputation: 171

Masonry layout for canvas

Can anyone suggest similar to https://github.com/shawnbot/masonic solution, but for canvas?

I need masonry-like layout where image tiles with different sizes will be positioned properly without lots of whitespace.

P.S. Canvas chosen beacause of large data and better performance.

Upvotes: 0

Views: 791

Answers (1)

markE
markE

Reputation: 105035

If by "properly" you mean with minimal white-space and disregarding any rectangle's order, then you are looking for a `bin packing algorithm'.

Here's one example (of the many available with a Google search):

https://github.com/jakesgordon/bin-packing

Upvotes: 2

Related Questions