Class: DrawioDsl::Schema::Layout
- Defined in:
- lib/drawio_dsl/schema/layouts/layout.rb
Overview
Provides base configuration for automatic layouts
Direct Known Subclasses
Instance Attribute Summary collapse
-
#anchor_x ⇒ Object
represents the x coordinate of the top left corner layout area this coordinate is based on the current location of the page.
-
#anchor_y ⇒ Object
Returns the value of attribute anchor_y.
Attributes inherited from Node
#classification, #id, #key, #nodes, #page, #parent
Instance Method Summary collapse
- #after_init ⇒ Object
- #fire_after_init ⇒ Object
-
#initialize(page, **args) ⇒ Layout
constructor
A new instance of Layout.
- #to_h ⇒ Object
Methods inherited from Node
#add_node, #debug, #debug_detail, #debug_row, #root?
Constructor Details
#initialize(page, **args) ⇒ Layout
Returns a new instance of Layout.
12 13 14 15 16 |
# File 'lib/drawio_dsl/schema/layouts/layout.rb', line 12 def initialize(page, **args) @after_init_fired = false super(page, **args.merge(classification: :layout_rule)) end |
Instance Attribute Details
#anchor_x ⇒ Object
represents the x coordinate of the top left corner layout area this coordinate is based on the current location of the page
9 10 11 |
# File 'lib/drawio_dsl/schema/layouts/layout.rb', line 9 def anchor_x @anchor_x end |
#anchor_y ⇒ Object
Returns the value of attribute anchor_y.
10 11 12 |
# File 'lib/drawio_dsl/schema/layouts/layout.rb', line 10 def anchor_y @anchor_y end |
Instance Method Details
#after_init ⇒ Object
25 26 27 28 |
# File 'lib/drawio_dsl/schema/layouts/layout.rb', line 25 def after_init @anchor_x ||= page.position_x @anchor_y ||= page.position_y end |
#fire_after_init ⇒ Object
18 19 20 21 22 23 |
# File 'lib/drawio_dsl/schema/layouts/layout.rb', line 18 def fire_after_init return if @after_init_fired @after_init_fired = true after_init end |
#to_h ⇒ Object
30 31 32 33 34 35 |
# File 'lib/drawio_dsl/schema/layouts/layout.rb', line 30 def to_h super.merge( anchor_x: anchor_x, anchor_y: anchor_y ) end |