Method: Scruffy::Layers::Stacked#render
- Defined in:
- lib/scruffy/layers/stacked.rb
#render(svg, options = {}) ⇒ Object
Overrides Base#render to fiddle with layers’ points to achieve a stacked effect.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/scruffy/layers/stacked.rb', line 32 def render(svg, = {}) #TODO ensure this works with new points current_points = points.dup layers.each do |layer| real_points = layer.points layer.points = current_points = .dup [:color] = layer.preferred_color || layer.color || [:theme].next_color layer.render(svg, ) .merge() layer.points = real_points layer.points.each_with_index { |val, idx| current_points[idx] -= val } end end |