Show:

A node in the render tree. As such, it wraps a layout or size node, providing them with an add method. By adding nodes, the render tree is constructed, the leaves of which are Surfaces.

Constructor

RenderTreeNode

(
  • object
)
private

Parameters:

  • object Object | SizeNode | LayoutNode | Surface | View

Item Index

Methods

Methods

add

(
  • node
)
RenderTreeNode chainable

Extends the render tree with a new node. Similar to how a tree data structure is created, but instead of a node with an array of children, children subscribe to notifications from the parent.

Nodes can be instances of LayoutNode, SizeNode, or Object literals with size and layout properties, in which case, appropriate nodes will be created.

This method also takes Views (subtrees) and Surfaces (leaves).

Parameters:

  • node Object | SizeNode | LayoutNode | Surface | View

    Node

Returns:

compose

(
  • spec
  • parentSpec
  • size
)
Object private

Defines the rules for composing layout specs: transform, align, origin and opacity. Transform is multiplied by the parent's transform (matrix multiplication). Align is a proportional offset relative to the parent size. Origin is a proportional offset relative to the current size. Opacity is multiplied by the parent's opacity.

Parameters:

  • spec Object

    Object layout spec

  • parentSpec Object

    Parent layout spec

  • size Array

    Object size

Returns:

Object:

The composed layout spec

compose

(
  • spec
  • parentSize
)
Object private

Defines the rules for composing size specs (size, margin, proportions) into a new size. A margin array reduces the parent size by an amount specified in pixels. A proportions array scales the parent size by a provided ratio. A size array [width, height] can take true, undefined, or numeric values. undefined takes the parent value true takes the value defined by the DOM numeric values override parent values

Parameters:

  • spec Object

    Object size spec

  • parentSize Object

    Parent size

Returns:

Object:

size Composed size