fixed horizontal height and width calculation
This commit is contained in:
parent
4aa052d9e4
commit
1cdfab7c03
@ -100,11 +100,11 @@ module Compass
|
|||||||
end
|
end
|
||||||
|
|
||||||
def height_for_horizontal_layout
|
def height_for_horizontal_layout
|
||||||
@height = @images.map {|image| image.height + image.spacing}.max
|
@height = @images.map {|image| image.height + image.offset}.max
|
||||||
end
|
end
|
||||||
|
|
||||||
def width_for_horizontal_layout
|
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
|
end
|
||||||
|
|
||||||
def width_for_vertical_layout
|
def width_for_vertical_layout
|
||||||
|
@ -154,6 +154,7 @@ class SpriteMapTest < Test::Unit::TestCase
|
|||||||
base = horizontal("spacing" => Sass::Script::Number.new(10, ['px']))
|
base = horizontal("spacing" => Sass::Script::Number.new(10, ['px']))
|
||||||
assert_equal [0, 20, 40, 60], base.images.map(&:left)
|
assert_equal [0, 20, 40, 60], base.images.map(&:left)
|
||||||
assert_equal [0, 0, 0, 0], base.images.map(&:top)
|
assert_equal [0, 0, 0, 0], base.images.map(&:top)
|
||||||
|
assert_equal 80, base.width
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should layout horizontaly with position" do
|
it "should layout horizontaly with position" do
|
||||||
|
Loading…
Reference in New Issue
Block a user