Class: SilkLayout::Layout::FlexLayout
- Inherits:
-
Object
- Object
- SilkLayout::Layout::FlexLayout
- Defined in:
- lib/silk_layout/layout/flex_layout.rb
Defined Under Namespace
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(box, context, cursor_y, parent_x, containing_width) ⇒ FlexLayout
constructor
A new instance of FlexLayout.
- #layout ⇒ Object
Constructor Details
#initialize(box, context, cursor_y, parent_x, containing_width) ⇒ FlexLayout
Returns a new instance of FlexLayout.
20 21 22 23 24 25 26 |
# File 'lib/silk_layout/layout/flex_layout.rb', line 20 def initialize(box, context, cursor_y, parent_x, containing_width) @box = box @context = context @cursor_y = cursor_y @parent_x = parent_x @containing_width = containing_width end |
Class Method Details
.layout(box, context, cursor_y = 0, parent_x = 0, containing_width = nil) ⇒ Object
16 17 18 |
# File 'lib/silk_layout/layout/flex_layout.rb', line 16 def self.layout(box, context, cursor_y = 0, parent_x = 0, containing_width = nil) new(box, context, cursor_y, parent_x, containing_width).layout end |
Instance Method Details
#layout ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/silk_layout/layout/flex_layout.rb', line 28 def layout setup_container if column? layout_column else layout_row end @box.width = @content_width + @box.padding[:left] + @box.padding[:right] + @box.border[:left] + @box.border[:right] @box.height = @content_height + @box.padding[:top] + @box.padding[:bottom] + @box.border[:top] + @box.border[:bottom] end |