Last modified: 2013-09-04 16:44:16 UTC
Steps to reproduce: * go to http://blue-dragon.wmflabs.org/wiki/Campaign:show-off-campaigns * watch the gallery layout make clean, justified margins * resize the window horizontally (up or down) * watch the gallery items reflow, but not resize -- now you have ragged margins Oh nooooooooo! Probably needs some JS code to hook window.onresize and adjust packed galleries if horizontal size changes. [This was seen on Yuvi's new UploadWizard campaign pages, but we think it's a general issue with the packed gallery.]
CCing bawolff
In the original design I was assuming that people wouldn't resize the window very much. I kind of consider resizing on window size change to be a nice feature to have, but not critical.
So part of the problem with doing this, is that the current algorithm relies on how the browser places the images initially, in order to figure out the size of the pictures. If we keep the current algorithm, one would have to first resize the images back to the original html sizes, and then re-run the layout algorithm again, everytime the window changed size.
I think that can be worked around... The 'natural size' of the images should be available to JavaScript directly[1], and if there's a portability problem, you can just save the original sizes in data attributes or something. [1] https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement <- naturalWidth and naturalHeight properties at least in HTML5