Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixing positioning issue #873

Closed
wants to merge 4 commits into from

3 participants

Valentine Bichkovsky Chris Eppstein Scott Davis
Valentine Bichkovsky

When there are some repeat-x images in the sprite and some other images have position set to 100%, there is a gap between sprite's right side and images with position = 100% (because width-fix was applied after they had been positioned).
I tried to figure out how to write a test for such case and I must say that your tests are difficult to comprehend ;)

Scott Davis
Owner

awesome thanks! can you write a test for this? also in the future could you make pull requests against the master branch!

Well, I just made a quick fix for myself and decided I should share it this way.
I can formulate the test - it should use a directory with several x-repeated images of different width + some regular wide image and check if sprite map's width is correct. But I'm not sure where to place this test in your test infrastructure.
As for the master branch - sprite map width is calculated in some other place there, and my fix is for version 0.11.5. (which I am currently using).

so to be clear what your doing here is bumping the total with to be a factor of the image your repeating? need to implement this in master

Chris Eppstein

@scottdavis can you review and merge when convenient?

Scott Davis scottdavis commented on the diff
lib/compass/sass_extensions/sprites/sprite_methods.rb
@@ -1,3 +1,5 @@
+require 'rational'
Scott Davis Owner

Do we need this require?

Nope, it just happened that my commit contained these changes and I created a pull request from it. You only need to change layout_methods.rb

Scott Davis Owner

manually changing something kinda makes using pull requests pointless =p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Chris Eppstein

@scottdavis what's the status here? Are you holding this up so that a single require can be removed? >_<

Scott Davis
Owner
Scott Davis
Owner

merged 5e42b8f

Scott Davis scottdavis closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  .gitignore
View
@@ -29,4 +29,6 @@ devbin
vendor/ruby
vendor
Gemfile.lock
+.emacs.*
*.pkg
+
8 lib/compass/sass_extensions/sprites/layout_methods.rb
View
@@ -50,12 +50,10 @@ def compute_image_positions!
end
@width = width_for_vertical_layout
+ calculate_repeat_extra_width! if @images.any?(&:repeat_x?)
calulate_vertical_postions
@height = height_for_vertical_layout
- if @images.any?(&:repeat_x?)
- calculate_repeat_extra_width!
- tile_images_that_repeat
- end
+ tile_images_that_repeat if @images.any?(&:repeat_x?)
end
end
@@ -156,4 +154,4 @@ def width_for_vertical_layout
end
end
end
-
+
4 lib/compass/sass_extensions/sprites/sprite_methods.rb
View
@@ -1,3 +1,5 @@
+require 'rational'
Scott Davis Owner

Do we need this require?

Nope, it just happened that my commit contained these changes and I created a pull request from it. You only need to change layout_methods.rb

Scott Davis Owner

manually changing something kinda makes using pull requests pointless =p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
module Compass
module SassExtensions
module Sprites
@@ -138,4 +140,4 @@ def log(action, filename, *extra)
end
end
end
-end
+end
Something went wrong with that request. Please try again.