Area
class Area
An area represents an oriented rectangular region. It is implemented as a 31-bit field. The open/close edges are specified along its parent's orientation axis, i.e. if the parent is horizontal, the left and right edges are defined, else if the parent is vertical, the top and bottom edges are defined. Similarly, the open/close edges of its children will be along its own orientation axis.
The orientation axes flip-flop along the hierarchy, i.e. an area's parent's orientation is always opposite to the area's own orientation. This is because if the orientation were to be same, the area's children could be "pulled up" to the parent making itself redundant.
All four edges of an area can be retrieved from it and its parent.
Field | Bits | Description |
---|---|---|
OPEN_OFFSET | 0-14 | The offset along the parent's axis at which the area begins. If orientation is horizontal, this is the left edge. If orientation is vertical, this is the top edge. |
CLOSE_OFFSET | 15-29 | The offset along the parent's axis at which the area ends. If orientation is horizontal, this is the right edge. If orientation is vertical, this is the bottom edge. |
ORIENTATION | 30 | The orientation of the area, which indicates the axis along it is split. The open and close offsets of its children are along this axis. See AreaOrientation. |
Constructor
new Area() → {}