Module: Compass::SassExtensions::Sprites::LayoutMethods
- Included in:
- SpriteMap
- Defined in:
- lib/compass/sass_extensions/sprites/layout_methods.rb
Constant Summary collapse
- HORIZONTAL =
'horizontal'
- DIAGONAL =
'diagonal'
- SMART =
'smart'
- VERTICAL =
'vertical'
Instance Method Summary collapse
-
#compute_image_positions! ⇒ Object
Calculates the overal image dimensions collects image sizes and input parameters for each sprite.
- #diagonal? ⇒ Boolean
- #horizontal? ⇒ Boolean
- #layout ⇒ Object
- #smart? ⇒ Boolean
- #vertical? ⇒ Boolean
Instance Method Details
#compute_image_positions! ⇒ Object
Calculates the overal image dimensions collects image sizes and input parameters for each sprite
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/compass/sass_extensions/sprites/layout_methods.rb', line 32 def compute_image_positions! case layout when SMART require 'compass/sass_extensions/sprites/layout/smart' @images, @width, @height = Layout::Smart.new(@images, @kwargs).properties when DIAGONAL require 'compass/sass_extensions/sprites/layout/diagonal' @images, @width, @height = Layout::Diagonal.new(@images, @kwargs).properties when HORIZONTAL require 'compass/sass_extensions/sprites/layout/horizontal' @images, @width, @height = Layout::Horizontal.new(@images, @kwargs).properties else require 'compass/sass_extensions/sprites/layout/vertical' @images, @width, @height = Layout::Vertical.new(@images, @kwargs).properties end end |
#diagonal? ⇒ Boolean
18 19 20 |
# File 'lib/compass/sass_extensions/sprites/layout_methods.rb', line 18 def diagonal? layout == DIAGONAL end |
#horizontal? ⇒ Boolean
14 15 16 |
# File 'lib/compass/sass_extensions/sprites/layout_methods.rb', line 14 def horizontal? layout == HORIZONTAL end |
#layout ⇒ Object
26 27 28 |
# File 'lib/compass/sass_extensions/sprites/layout_methods.rb', line 26 def layout @layout ||= @kwargs.get_var('layout').value end |
#smart? ⇒ Boolean
10 11 12 |
# File 'lib/compass/sass_extensions/sprites/layout_methods.rb', line 10 def smart? layout == SMART end |
#vertical? ⇒ Boolean
22 23 24 |
# File 'lib/compass/sass_extensions/sprites/layout_methods.rb', line 22 def vertical? layout == VERTICAL end |