fixed horizontal height and width calculation

This commit is contained in:
Scott Davis 2011-08-12 15:34:04 -04:00
parent 4aa052d9e4
commit 1cdfab7c03
2 changed files with 3 additions and 2 deletions

View File

@ -100,11 +100,11 @@ module Compass
end
def height_for_horizontal_layout
@height = @images.map {|image| image.height + image.spacing}.max
@height = @images.map {|image| image.height + image.offset}.max
end
def width_for_horizontal_layout
@images.inject(0) { |sum, image| sum += (image.width + image.offset) }
@images.inject(0) { |sum, image| sum += (image.width + image.spacing) }
end
def width_for_vertical_layout

View File

@ -154,6 +154,7 @@ class SpriteMapTest < Test::Unit::TestCase
base = horizontal("spacing" => Sass::Script::Number.new(10, ['px']))
assert_equal [0, 20, 40, 60], base.images.map(&:left)
assert_equal [0, 0, 0, 0], base.images.map(&:top)
assert_equal 80, base.width
end
it "should layout horizontaly with position" do