Class: Scruffy::Components::Label

Inherits:
Base
  • Object
show all
Defined in:
lib/scruffy/components/label.rb

Instance Attribute Summary

Attributes inherited from Base

#id, #options, #position, #size, #visible

Instance Method Summary collapse

Methods inherited from Base

#initialize, #process, #render

Constructor Details

This class inherits a constructor from Scruffy::Components::Base

Instance Method Details

#draw(svg, bounds, options = {}) ⇒ Object



4
5
6
7
8
# File 'lib/scruffy/components/label.rb', line 4

def draw(svg, bounds, options={})
  svg.text(@options[:text], :class => 'text', :x => (bounds[:width] / 2), :y => bounds[:height], 
          'font-size' => relative(100), :fill => options[:theme].marker, :stroke => 'none', 'stroke-width' => '0',
          'text-anchor' => (@options[:text_anchor] || 'middle'))
end