Class: Scruffy::Components::Title

Inherits:
Base
  • Object
show all
Defined in:
lib/scruffy/components/title.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
9
10
11
12
13
14
15
16
# File 'lib/scruffy/components/title.rb', line 4

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