class Dedalus::Elements::Text

Attributes

padding[RW]
scale[RW]
text[RW]

Public Class Methods

description() click to toggle source
# File lib/dedalus/elements/text.rb, line 38
def self.description
  "words"
end
example_data() click to toggle source

sample data for the explorer…

# File lib/dedalus/elements/text.rb, line 34
def self.example_data
  { text: "Hello World" }
end

Public Instance Methods

dimensions() click to toggle source
# File lib/dedalus/elements/text.rb, line 29
def dimensions
  [ width, height ]
end
height() click to toggle source
# File lib/dedalus/elements/text.rb, line 17
def height
  2*padding + (font.height * scale)
end
render(*) click to toggle source
# File lib/dedalus/elements/text.rb, line 6
def render(*)
  x,y = *position
  font.draw(text, x + padding, y + padding, z_order, self.scale, self.scale)

  # draw_bounding_box(origin: [x,y], dimensions: dimensions)
end
width() click to toggle source
# File lib/dedalus/elements/text.rb, line 13
def width
  2*padding + (font.text_width(text) * scale)
end