3 ms·
I don't think the point of this library is to provide a best fit layout as Masonry tries to. Instead this is a layout manager in which you could encode any num
by n8agrin 16y ago
I don't think the point of this library is to provide a best fit layout as Masonry tries to. Instead this is a layout manager in which you could encode any number of layout algorithms including the Masonry algorithm.
This layout manager design pattern, while likely always less efficient than native browser mechanisms, is something we'll probably see more of as the browser takes on a greater role as an application host. Without programmatic layout to complement or override the browser's native layout system we won't get the sorts of visual UI building systems and application layouts you're starting to see in frameworks like Cappuccino and Sproutcore.
- bramstein 16y agoYou hit the nail on the head. The library is meant for applications that can not use CSS layout, because the algorithm they need is not possible in CSS, or because they are rendering to a context that does not have layout management such as Canvas or SVG. Think of projects like Mozilla Bespin (https://mozillalabs.com/bespin/ https://mozillalabs.com/bespin/) which uses Canvas for drawing its editor. Having standard layout algorithms available would be a great help there. I was quite hesitant about making the jQuery plugin public because I was fearing reactions such as this. It was meant as a demo, and a nice way to test the layout managers. For a long time I had a message on the jQuery plugin page stating something along the lines of "please, please, consider using CSS before you use this plugin." The nice thing about programming against a layout manager API is that you can easily write new algorithms while the (DOM) interface remains the same. It would be trivial to write a layout manager that does layout like Masonry. As another example, I'm currently working on a pack layout which can be used to pack small images into a larger one (e.g. CSS sprites,) and a layout manager that implements the CSS box layout module. I was also considering a text layout based on my TeX line breaking work (http://www.bramstein.com/projects/typeset/. http://www.bramstein.com/projects/typeset/.)