Support global and configuration-specific icon margin and padding#55
Open
stevenyxu wants to merge 5 commits into
Open
Support global and configuration-specific icon margin and padding#55stevenyxu wants to merge 5 commits into
stevenyxu wants to merge 5 commits into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.