fixed problem with decimal math and being able to position sprites with "%"s fixes #415

This commit is contained in:
Scott Davis 2011-06-19 11:24:44 -04:00
parent 124a193345
commit e0abb38e2f

View File

@ -38,7 +38,7 @@ module Compass
# collects image sizes and input parameters for each sprite # collects image sizes and input parameters for each sprite
def compute_image_positions! def compute_image_positions!
@images.each_with_index do |image, index| @images.each_with_index do |image, index|
image.left = image.position.unit_str == "%" ? (@width - image.width) * (image.position.value / 100) : image.position.value image.left = image.position.unit_str == "%" ? (@width - image.width) * (image.position.value / 100.0) : image.position.value
next if index == 0 next if index == 0
last_image = @images[index-1] last_image = @images[index-1]
image.top = last_image.top + last_image.height + [image.spacing, last_image.spacing].max image.top = last_image.top + last_image.height + [image.spacing, last_image.spacing].max