class Compass::SassExtensions::Sprites::Layout::Smart
Public Instance Methods
layout!()
click to toggle source
# File lib/compass/sass_extensions/sprites/layout/smart.rb, line 7 def layout! calculate_positions! end
Private Instance Methods
calculate_positions!()
click to toggle source
# File lib/compass/sass_extensions/sprites/layout/smart.rb, line 13 def calculate_positions! fitter = ::Compass::SassExtensions::Sprites::RowFitter.new(@images) current_y = 0 fitter.fit!.each do |row| current_x = 0 row.images.each_with_index do |image, index| image.left = current_x image.top = current_y current_x += image.width end current_y += row.height end @width = fitter.width @height = fitter.height end