Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprite image layout class #9

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

mouyang
Copy link

@mouyang mouyang commented Feb 17, 2014

Try to refactor layouts out of an enum into a proper class. Use a naming convention on layout id to map to a specific implementation. This should open the possibility of swapping in different layout algorithms such as https://github.com/clyfish/zerosprites or http://issues.carrot2.org/browse/SMARTSPRITES-64.

Ticket http://issues.carrot2.org/browse/SMARTSPRITES-92

- replace SpriteImageDirective.SpriteImageLayout enum with
  SpriteImageLayout interface
- try to stop checking for an enum value and check Class.isAssignableFrom

- add new SpriteImageDirective.valueOf method to output a SpriteImageLayout
  by convention
- add implementations of SpriteImageLayout (HorizontalLayout and
  VerticalLayout) and put as many things as possible in there.
- modify test cases to use new valueOf method
- move to SpriteImageLayout.calculateRepeatAlignmentDimension
- add AbstractLayout.getDimensions
- put return value in local variable and set initial value to
  defaultLayout
correctAlignment + getDefaultAlignment methods
use SpriteImageLayout methods instead
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.

1 participant