put in the row fitter

This commit is contained in:
John Bintz 2011-05-16 11:35:00 -04:00
parent cc26b98909
commit 370044ba77
5 changed files with 7 additions and 38 deletions

View File

@ -7,7 +7,7 @@ GIT
PATH
remote: .
specs:
compass (0.11.1.d9ca08f)
compass (0.11.1.cc26b98)
chunky_png (~> 1.1)
fssm (>= 0.2.7)
sass (~> 3.1)

View File

@ -71,16 +71,10 @@ module Compass
# collects image sizes and input parameters for each sprite
def compute_image_positions!
imgs = @images.sort { |a,b| a.width <=> b.width }
rows = [::Compass::SassExtensions::Sprites::ImageRow.new(@width)]
imgs.each do |image|
next if rows.last.add(image)
rows << ::Compass::SassExtensions::Sprites::ImageRow.new(@width)
unless rows.last.add(image)
raise "Image failed to be added"
end
end
fitter = ::Compass::SassExtensions::Sprites::RowFitter.new(imgs)
rows = fitter.fit!
current_y = 0
rows.each do |row|
current_x = 0

View File

@ -1,18 +0,0 @@
module Compass
module SassExtensions
module Sprites
class ImageGroup
attr_reader :images
def initialize(images = [])
@images = images
end
def best_fitting_rows
end
end
end
end
end

View File

@ -8,6 +8,7 @@ module Compass
attr_reader :images, :rows
def_delegators :rows, :[]
def initialize(images)
@images = images
@rows = []
@ -15,6 +16,7 @@ module Compass
def fit!(style = :scan)
send("#{style}_fit")
@rows
end
def width

View File

@ -1,9 +0,0 @@
require 'test_helper'
require 'compass/sass_extensions/sprites/image_group'
class ImageGroupTest < Test::Unit::TestCase
def setup
end
end