Class: DrawioDsl::LayoutEngine
- Inherits:
-
Object
- Object
- DrawioDsl::LayoutEngine
- Defined in:
- lib/drawio_dsl/layout_engine.rb
Overview
The layout engine is responsible for laying out the elements on the page.
The layout engine can automatically place elements on the page.
It will keep track of layout boundaries, current position and flow direction. Elements will be placed on the page in the order they are added. Row/column flow objects will hold information about horizontal and vertical element padding
Instance Attribute Summary collapse
-
#current_layout ⇒ Object
readonly
Returns the value of attribute current_layout.
-
#current_page ⇒ Object
readonly
Returns the value of attribute current_page.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(page) ⇒ LayoutEngine
constructor
A new instance of LayoutEngine.
Constructor Details
#initialize(page) ⇒ LayoutEngine
Returns a new instance of LayoutEngine.
17 18 19 |
# File 'lib/drawio_dsl/layout_engine.rb', line 17 def initialize(page) @page = page end |
Instance Attribute Details
#current_layout ⇒ Object (readonly)
Returns the value of attribute current_layout.
15 16 17 |
# File 'lib/drawio_dsl/layout_engine.rb', line 15 def current_layout @current_layout end |
#current_page ⇒ Object (readonly)
Returns the value of attribute current_page.
14 15 16 |
# File 'lib/drawio_dsl/layout_engine.rb', line 14 def current_page @current_page end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
12 13 14 |
# File 'lib/drawio_dsl/layout_engine.rb', line 12 def page @page end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/drawio_dsl/layout_engine.rb', line 21 def call page.position_x = page.margin_left page.position_y = page.margin_top page.nodes.all.each do |node| traverse_node(node) end end |