Skip to content

Conversation

@stevenyxu
Copy link

The current SpriteSheetConfiguration.prototype.layoutImages implementation draws from an options property that is never set. Set it in the configuration constructor so that {h,v}{padding,margin} can be set in the config. Adding readme sections explaining usage.

To support configuration-specific margin and padding, we need to detect if it's necessary to re-print the entire sizing and background-positioning CSS for every media query block. In the base case (no configuration-specific spacing), the code detects that it's not needed to re-print the sizing declarations in the media query block, so there's no additional file size impact on the base case. In the special case, the full sizing declaration is re-printed in every media query block.

We could be smarter and only re-print if it's necessary (e.g., if there's only custom spacing for 3x pixel ratio but 2x has the same spacing as 1x).

This is related to the previous PR #54 but fixes the issue that was causing retina and non-retina output images to be different when hmargin, etc. were used.

trevorah and others added 5 commits March 28, 2014 13:49
The current SpriteSheetConfiguration.prototype.layoutImages
implementation draws from an options property that is never set. Set it
in the configuration constructor so that {h,v}{padding,margin} can be
set in the config. Adding readme sections explaining usage.

To support configuration-specific margin and padding, we need to detect
if it's necessary to re-print the entire sizing and
background-positioning CSS for every media query block. In the base case
(no configuration-specific spacing), the code detects that it's not
needed to re-print the sizing declarations in the media query block, so
there's no additional file size impact on the base case. In the special
case, the full sizing declaration is re-printed in every media query
block.

We could be smarter and only re-print if it's necessary (e.g., if
there's only custom spacing for 3x pixel ratio but 2x has the same
spacing as 1x).
Without this adjustment, retina and non-retina runs of the Layout
builder would result in different tiling outputs. Multiplying the
requested spacing by the pixel ratio seems to result in the same end
result with only the pixel ratio different, allowing us to not have to
repeat positioning CSS declarations between retina and non-retina images
in the more common case where the same spacing is requested for both
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants