Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
wants to merge 1 commit into from

3 participants

@camilonova

No description provided.

@scottdavis
Owner

Now we are getting there!

@camilonova

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

@scottdavis scottdavis was assigned
@camilonova

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

@camilonova

@scottdavis can I get a little help in here?

@chriseppstein

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.

@chriseppstein

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

@camilonova

So sad.

@chriseppstein

@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
View
17 lib/compass/sass_extensions/sprites/layout/smart.rb
@@ -13,14 +13,29 @@ def layout!
def calculate_positions!
fitter = ::Compass::SassExtensions::Sprites::RowFitter.new(@images)
current_y = 0
+ width = 0
+ height = 0
+ last_row_spacing = 9999
fitter.fit!.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
- image.top = current_y
+ image.top = current_y + extra_y
current_x += image.width
+ width = [width, current_x].max
+ row_height = [row_height, extra_y + image.height + image.spacing].max
end
current_y += row.height
+ height = [height, current_y].max
+ last_row_spacing = row_height - row.height
+ current_y += last_row_spacing
end
@width = fitter.width
@height = fitter.height
Something went wrong with that request. Please try again.