Page MenuHomePhabricator

New-style packed gallery shows ragged edges after window resize
Closed, ResolvedPublic

Description

Steps to reproduce:

Oh nooooooooo!

Probably needs some JS code to hook window 'resize' event and adjust packed galleries if horizontal size changes.

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:11 AM
bzimport set Reference to bz53664.
bzimport added a subscriber: Unknown Object (MLST).

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

matmarex set Security to None.
matmarex added a project: good first task.

Change 182652 had a related patch set uploaded (by M4tx):
Adjust images in packed gallery on window resize

https://gerrit.wikimedia.org/r/182652

Patch-For-Review

Change 182652 merged by jenkins-bot:
Adjust images in packed gallery on window resize

https://gerrit.wikimedia.org/r/182652

matmarex removed a project: Patch-For-Review.
matmarex removed a subscriber: Unknown Object (MLST).

Change 183989 had a related patch set uploaded (by Bartosz Dziewoński):
Fix gallery rearrange on resize with missing images

https://gerrit.wikimedia.org/r/183989

Patch-For-Review

(The follow-up patch was actually submitted by @m4tx too.)

Change 183989 merged by jenkins-bot:
Fix gallery rearrange on resize with missing images

https://gerrit.wikimedia.org/r/183989