Class: DrawioDsl::Schema::Text

Inherits:
Shape show all
Defined in:
lib/drawio_dsl/schema/text.rb

Overview

Text represents text shapes such as h1, h2, p, etc.

Direct Known Subclasses

H1, H2, H3, H4, H5, H6, P

Constant Summary

Constants included from Formatters::Factory

Formatters::Factory::FORMATTERS

Instance Attribute Summary

Attributes inherited from Shape

#fill_color, #font_color, #glass, #gradient, #h, #html, #rounded, #shadow, #sketch, #stroke_color, #style_modifiers, #theme, #title, #value, #w, #white_space, #x, #y

Attributes inherited from Node

#classification, #id, #key, #nodes, #page, #parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Shape

#add_base_modifiers, #as_xml, #bg_theme_palette, configure_shape, #debug, #draw_element, #draw_line, #format, #initialize, #shape_defaults, #style, #theme_palette, #to_h

Methods included from Formatters::Factory

#format_instance, #formatter

Methods inherited from Node

#add_node, #debug, #debug_detail, #debug_row, #initialize, #root?, #to_h

Constructor Details

This class inherits a constructor from DrawioDsl::Schema::Shape

Class Method Details

.configure_as(key) ⇒ Object



8
9
10
# File 'lib/drawio_dsl/schema/text.rb', line 8

def configure_as(key)
  configure_shape(key, :text)
end

Instance Method Details

#apply_defaults(args) ⇒ Object

def initialize(page, **args)

args[:classification] = :text
super(page, **args)

end



18
19
20
21
22
23
24
25
# File 'lib/drawio_dsl/schema/text.rb', line 18

def apply_defaults(args)
  super(args)

  @fill_color       = args[:fill_color]
  @stroke_color     = args[:stroke_color]
  @gradient         = args[:gradient]
  @font_color       = args[:font_color] || page.bg_theme_palette.font_color
end

#default_configurationObject



27
28
29
# File 'lib/drawio_dsl/schema/text.rb', line 27

def default_configuration
  KConfig.configuration.drawio.shape.default_text
end