Singleton expansion has... expanded!

Closes #13, hopefully
This commit is contained in:
Andy Meneely
2014-08-11 00:22:04 -04:00
parent 91bcfb06e2
commit 3e08a0d604
12 changed files with 222 additions and 126 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ module Squib
# @api public
def background(opts = {})
opts = needs(opts,[:range, :color])
opts[:range].each { |i| @cards[i].background(opts[:color]) }
opts[:range].each { |i| @cards[i].background(opts[:color][i]) }
end
end
+3 -2
View File
@@ -20,7 +20,7 @@ module Squib
opts = needs(opts, [:range, :files, :x, :y, :alpha, :layout])
@progress_bar.start("Loading PNGs #{location(opts)}", opts[:range].size) do |bar|
opts[:range].each do |i|
@cards[i].png(opts[:file][i], opts[:x], opts[:y], opts[:alpha])
@cards[i].png(opts[:file][i], opts[:x][i], opts[:y][i], opts[:alpha][i])
bar.increment
end
end
@@ -46,7 +46,8 @@ module Squib
p = needs(opts,[:range, :files, :svgid, :x, :y, :width, :height, :layout])
@progress_bar.start("Loading SVGs #{location(opts)}", p[:range].size) do |bar|
p[:range].each do |i|
@cards[i].svg(p[:file][i], p[:id], p[:x], p[:y], p[:width], p[:height])
@cards[i].svg(p[:file][i], p[:id][i], p[:x][i], p[:y][i],
p[:width][i], p[:height][i])
bar.increment
end
end
+1 -1
View File
@@ -30,7 +30,7 @@ module Squib
# @api public
def set(opts = {})
opts = needs(opts, [:font])
@font = opts[:font]
@font = opts[:font][0] #was expanded - just need the first
end
end
+14 -10
View File
@@ -21,12 +21,13 @@ module Squib
# @return [nil] intended to be void
# @api public
def rect(opts = {})
opts = needs(opts, [:range, :x, :y, :width, :height, :radius,
opts = needs(opts, [:range, :x, :y, :width, :height, :rect_radius, :x_radius, :y_radius,
:fill_color, :stroke_color, :stroke_width, :layout])
opts[:range].each do |i|
@cards[i].rect(opts[:x], opts[:y], opts[:width], opts[:height],
opts[:x_radius], opts[:y_radius],
opts[:fill_color], opts[:stroke_color], opts[:stroke_width])
@cards[i].rect(opts[:x][i], opts[:y][i], opts[:width][i], opts[:height][i],
opts[:x_radius][i], opts[:y_radius][i],
opts[:fill_color][i], opts[:stroke_color][i],
opts[:stroke_width][i])
end
end
@@ -49,8 +50,8 @@ module Squib
opts = needs(opts, [:range, :x, :y, :circle_radius, :layout,
:fill_color, :stroke_color, :stroke_width])
opts[:range].each do |i|
@cards[i].circle(opts[:x], opts[:y], opts[:radius],
opts[:fill_color], opts[:stroke_color], opts[:stroke_width])
@cards[i].circle(opts[:x][i], opts[:y][i], opts[:radius][i],
opts[:fill_color][i], opts[:stroke_color][i], opts[:stroke_width][i])
end
end
@@ -75,8 +76,11 @@ module Squib
opts = needs(opts, [:range, :x1, :y1, :x2, :y2, :x3, :y3, :layout,
:fill_color, :stroke_color, :stroke_width])
opts[:range].each do |i|
@cards[i].triangle(opts[:x1], opts[:y1], opts[:x2], opts[:y2],opts[:x3], opts[:y3],
opts[:fill_color], opts[:stroke_color], opts[:stroke_width])
@cards[i].triangle(opts[:x1][i], opts[:y1][i],
opts[:x2][i], opts[:y2][i],
opts[:x3][i], opts[:y3][i],
opts[:fill_color][i], opts[:stroke_color][i],
opts[:stroke_width][i])
end
end
@@ -98,8 +102,8 @@ module Squib
opts = needs(opts, [:range, :x1, :y1, :x2, :y2, :layout,
:stroke_color, :stroke_width])
opts[:range].each do |i|
@cards[i].line(opts[:x1], opts[:y1], opts[:x2], opts[:y2],
opts[:stroke_color], opts[:stroke_width])
@cards[i].line(opts[:x1][i], opts[:y1][i], opts[:x2][i], opts[:y2][i],
opts[:stroke_color][i], opts[:stroke_width][i])
end
end
+6 -3
View File
@@ -35,10 +35,13 @@ module Squib
# @api public
def text(opts = {})
opts = needs(opts, [:range, :str, :font, :x, :y, :width, :height, :color, :wrap,
:align, :justify, :valign, :ellipsize, :hint, :layout])
opts[:str] = [opts[:str]] * @cards.size unless opts[:str].respond_to? :each
:align, :justify, :valign, :markup, :ellipsize, :hint, :layout])
opts[:range].each do |i|
@cards[i].text(opts[:str][i], opts[:font], opts[:x], opts[:y], opts[:color], opts)
@cards[i].text(opts[:str][i], opts[:font][i], opts[:color][i],
opts[:x][i], opts[:y][i], opts[:width][i], opts[:height][i],
opts[:markup][i], opts[:justify][i], opts[:wrap][i],
opts[:ellipsize][i], opts[:spacing][i], opts[:align][i],
opts[:valign][i], opts[:hint][i])
end
end