Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Consider spacing on smart layout. Improves #1303 Fixes #718 #1429

wants to merge 1 commit into from

3 participants


No description provided.


Now we are getting there!


@scottdavis great, so how can we make this happen?

@scottdavis scottdavis was assigned

@scottdavis I'll need help for the unit test.


@scottdavis can I get a little help in here?


I'm closing this PR because there's been too much change since it was initially submitted. Sorry, We're going to do better going forward. Hopefully, someone can resubmit the change against 1.0. Features should be submitted to the master branch, bug fixes to the stable branch.


Should be on top of the changes coming in #1771.


So sad.


@camilonova I agree. I don't think it will be hard to clean this patch up. I'm trying to get this project back on track, and that meant focusing on some core things for a while. But now we're ready to receive PRs like 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.
Showing with 16 additions and 1 deletion.
  1. +16 −1 lib/compass/sass_extensions/sprites/layout/smart.rb
17 lib/compass/sass_extensions/sprites/layout/smart.rb
@@ -13,14 +13,29 @@ def layout!
def calculate_positions!
fitter =
current_y = 0
+ width = 0
+ height = 0
+ last_row_spacing = 9999!.each do |row|
current_x = 0
+ current_x = 0
+ row_height = 0
row.images.each_with_index do |image, index|
+ extra_y = [image.spacing - last_row_spacing,0].max
+ if index > 0
+ last_image = row.images[index-1]
+ current_x += [image.spacing, last_image.spacing].max
+ end
image.left = current_x
- = current_y
+ = current_y + extra_y
current_x += image.width
+ width = [width, current_x].max
+ row_height = [row_height, extra_y + image.height + image.spacing].max
current_y += row.height
+ height = [height, current_y].max
+ last_row_spacing = row_height - row.height
+ current_y += last_row_spacing
@width = fitter.width
@height = fitter.height
Something went wrong with that request. Please try again.