lib/polymer/deviant_finder.rb in polymer-1.0.0.beta.6 vs lib/polymer/deviant_finder.rb in polymer-1.0.0.beta.7
- old
+ new
@@ -19,26 +19,26 @@
def self.find_deviants(sprite)
# Need more than two sources to find deviants.
return false if sprite.sources.size < 2
mean, std_dev = standard_deviation(sprite.sources.map do |source|
- source.image.columns
+ source.image.width
end)
return false if std_dev < 100 # Skip images with a < 100px deviation.
deviants = sprite.sources.select do |source|
- width = source.image.columns
+ width = source.image.width
width > mean + std_dev || width < mean - std_dev
end
deviants.any? and deviants
end
# Print a warning if the sprite contains wide sources.
def self.format_ui_message(sprite, deviants)
if deviants
- <<-MESSAGE.compress_lines
+ Polymer.compress_lines(<<-MESSAGE)
Your "#{sprite.name}" sprite contains one or more source images
which deviate significantly from the average source width. You might
want to consider removing these sources from the sprite in order to
reduce the sprite filesize.