Component used to limit other visual components to a certain area on the graph.
# File lib/scruffy/components/viewport.rb, line 6 def initialize(*args, &block) super(*args) self.components = [] block.call(self.components) if block end
# File lib/scruffy/components/viewport.rb, line 13 def draw(svg, bounds, options={}) svg.g(options_for) { self.components.each do |component| component.render(svg, bounds_for([bounds[:width], bounds[:height]], component.position, component.size), options) end } end