Class: DrawioDsl::Schema::FlexLayout
- Defined in:
- lib/drawio_dsl/schema/layouts/flex_layout.rb
Overview
Provides flex style layouts
Instance Attribute Summary collapse
-
#direction ⇒ Object
Returns the value of attribute direction.
-
#gap ⇒ Object
readonly
Returns the value of attribute gap.
-
#perpendicular_max ⇒ Object
readonly
Returns the value of attribute perpendicular_max.
-
#wrap_at ⇒ Object
Returns the value of attribute wrap_at.
Attributes inherited from Layout
Attributes inherited from Node
#classification, #id, #key, #nodes, #page, #parent
Instance Method Summary collapse
-
#initialize(page, **args) ⇒ FlexLayout
constructor
A new instance of FlexLayout.
- #position_shape(shape) ⇒ Object
- #to_h ⇒ Object
Methods inherited from Layout
Methods inherited from Node
#add_node, #debug, #debug_detail, #debug_row, #root?
Constructor Details
#initialize(page, **args) ⇒ FlexLayout
Returns a new instance of FlexLayout.
12 13 14 15 16 17 18 19 |
# File 'lib/drawio_dsl/schema/layouts/flex_layout.rb', line 12 def initialize(page, **args) @direction = args[:direction] || :horizontal @wrap_at = args[:wrap_at] || (direction == :horizontal ? 1000 : 800) @gap = args[:gap] || 20 @perpendicular_max = 0 super(page, **args.merge(key: :flex_layout)) end |
Instance Attribute Details
#direction ⇒ Object
Returns the value of attribute direction.
7 8 9 |
# File 'lib/drawio_dsl/schema/layouts/flex_layout.rb', line 7 def direction @direction end |
#gap ⇒ Object (readonly)
Returns the value of attribute gap.
9 10 11 |
# File 'lib/drawio_dsl/schema/layouts/flex_layout.rb', line 9 def gap @gap end |
#perpendicular_max ⇒ Object (readonly)
Returns the value of attribute perpendicular_max.
10 11 12 |
# File 'lib/drawio_dsl/schema/layouts/flex_layout.rb', line 10 def perpendicular_max @perpendicular_max end |
#wrap_at ⇒ Object
Returns the value of attribute wrap_at.
8 9 10 |
# File 'lib/drawio_dsl/schema/layouts/flex_layout.rb', line 8 def wrap_at @wrap_at end |
Instance Method Details
#position_shape(shape) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/drawio_dsl/schema/layouts/flex_layout.rb', line 21 def position_shape(shape) fire_after_init position_shape_horizontally(shape) if direction == :horizontal position_shape_vertically(shape) if direction == :vertical end |
#to_h ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/drawio_dsl/schema/layouts/flex_layout.rb', line 28 def to_h fire_after_init super.merge( direction: direction, wrap_at: wrap_at, boundary: boundary, perpendicular_max: perpendicular_max ) end |