diff --git a/lib/compass/sass_extensions/sprites/layout_methods.rb b/lib/compass/sass_extensions/sprites/layout_methods.rb index 60da675c..258328ac 100644 --- a/lib/compass/sass_extensions/sprites/layout_methods.rb +++ b/lib/compass/sass_extensions/sprites/layout_methods.rb @@ -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 diff --git a/test/units/sprites/sprite_map_test.rb b/test/units/sprites/sprite_map_test.rb index b9f4a0ef..8360b086 100644 --- a/test/units/sprites/sprite_map_test.rb +++ b/test/units/sprites/sprite_map_test.rb @@ -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