diff --git a/lib/compass/sass_extensions/functions/sprites.rb b/lib/compass/sass_extensions/functions/sprites.rb index b660514a..7df04e20 100644 --- a/lib/compass/sass_extensions/functions/sprites.rb +++ b/lib/compass/sass_extensions/functions/sprites.rb @@ -331,7 +331,7 @@ module Compass::SassExtensions::Functions::Sprites if offset_x.unit_str == "%" x = offset_x # CE: Shouldn't this be a percentage of the total width? else - x = offset_x.value + image[:left] + x = offset_x.value - image[:left] x = Sass::Script::Number.new(x, x == 0 ? [] : ["px"]) end y = offset_y.value - image[:top] diff --git a/spec/sprites_spec.rb b/spec/sprites_spec.rb index 331729d7..ee26a915 100644 --- a/spec/sprites_spec.rb +++ b/spec/sprites_spec.rb @@ -277,7 +277,7 @@ describe Compass::Sprites do } .adjusted-px-1 { - background-position: 14px 0; + background-position: -6px 0; } .adjusted-px-2 { @@ -315,7 +315,7 @@ describe Compass::Sprites do } .adjusted-px-1 { - background-position: 14px 0; + background-position: -6px 0; } .adjusted-px-2 { @@ -362,11 +362,11 @@ describe Compass::Sprites do } .squares-ten-by-ten { - background-position: 10px 0; + background-position: -10px 0; } .squares-twenty-by-twenty { - background-position: 10px -10px; + background-position: -10px -10px; } CSS image_size('squares-*.png').should == [30, 30]