Class: DrawioDsl::Schema::Element

Inherits:
Shape
  • Object
show all
Defined in:
lib/drawio_dsl/schema/element.rb

Overview

Elements represents some kind of shape such as a Square, Circle, Callout, Actor, etc.

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/element.rb', line 8

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

Instance Method Details

#apply_defaults(args) ⇒ Object

def initialize(page, **args)

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

end



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

def apply_defaults(args)
  super(args)

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

#default_configurationObject



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

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