class

Layout::Block

Inherits Layout::PrimitiveTools < Reference < Object

A 2-dimensional region within the layout. You can constrain the different Primitives on a block in order to properly position it.

Example

The follow will create a 100x100 square that is offset from the top left corner of the screen by half it's width.

region = Block.new
region.height.eq 100
region.width.eq 100
region.top.eq region.width / 2
region.left.eq region.width / 2

Constructors

new(label : String)

Initialize with a label for easier debugging.

Source

Instance methods

bottom
center_x
center_y
children

You can encapsulate blocks inside of each other as children. This makes it easier to compose complex layout blocks.

Source
children=(children : Array(Layout::Block))

You can encapsulate blocks inside of each other as children. This makes it easier to compose complex layout blocks.

Source
each

Enumerate over all blocks in this block's hierarchy.

Source
each_constraint

Enumerate over all constraints in this block's hierarchy

Source
height
label

This is a unique or manually set identifier to help in debugging

Source
label=(label : String)

Re-assign the label of this block. Providing a label helps to provide context when debugging. You can also add a label in #initialize

Source
left
right
top
width
x

An alias to the #left primitive

Source
y

An alias to the #top primitive

Source