adobe-photoshop/generator-assets — pull request #277 by iwehrman (2014-08-27 21:43:54+00:00)
Title: Fix approximate bounds for layer comp assets

I spoke a bit too soon about #275 completely fixing #273... That PR fixed the bounds calculation for layer comps in the "exact bounds" path, but not the "approximate bounds" path. This manifested itself in the [original test PSD](http://cloud.wehrman.org/0d3n1J3M2Z3C) by yielding assets with trivial scaling (i.e., an integer scaling factor) that use the visible bounds for padding (i.e., no padding), and by creating assets with non-trivial scaling that instead use the document bounds for padding. This changes the bounds computation for assets with trivial scaling (i.e., approximate bounds computation) to also use the document bounds for padding. As a result, the document bounds are now always used for the bounds of generated assets.

This differs somewhat from the way we generate layer assets, in which the bounds of generated assets always correspond to the layer bounds cropped to visible pixels. I think this is reasonable behavior though, given that the ostensible purpose of the layer comps feature is to create whole-document previews. Either way, at least it's consistent...

@jhatwich do you have time to test and review this? This is stuff probably fresher in your head than anyone else's. If not, just let me know and I'll twist @joelrbrandt's arm. I've confirmed that the assets generated for the aforementioned test PSD look correct, and that there aren't any regressions in the automated tests, but I hope someone will check my work!