This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. If you intend to use an extension in production, you should copy the code to your own source directory. See the Extensions intro page for more information.
Constructs a PanelLayoutFlow that lays out elements in rows with no space between the elements or between the rows.
Optional
init: Partial<PanelLayoutFlow>Gets or sets the initial direction in which elements are laid out. The value must be 0 or 180, which results in rows, or 90 or 270, which results in columns.
The default value is 0, resulting in rows that go rightward. A value of 90 results in columns that go downward.
Setting this property does not notify about any changed event, nor does a change in value automatically cause the panel layout to be performed again.
Gets or sets the space between adjacent elements in the panel and the space between adjacent rows or columns.
The default value is (0, 0). The size is in the panel's coordinate system.
Setting this property does not notify about any changed event, nor does a change in value automatically cause the panel layout to be performed again.
Override
arrangeAfter measuring, a Panel must arrange each element, giving the elements a position and size in the Panel's coordinate system. This must call arrangeElement with each Panel element, which will set that element's GraphObject.actualBounds.
For arranging some elements, it is useful to know the total unioned area of every element, which is given as the union
argument.
This Rect can be used to right-align or center-align, etc, elements within an area.
For example, PanelLayoutHorizontal arranges each element sequentially, starting with an x
value of 0
,
and increasing it by each previous element's GraphObject.measuredBounds width
.
The horizontal Panel arranges each element with a y
value determined by the union
argument's height
considering the GraphObject.alignment of the element, and the GraphObject's own measuredBounds.height
.
Panel which called this layout
Array of Panel elements
rectangle, if properly constructed in measure, that contains the expected union bounds of every element in the Panel.
Override
measureGiven the available size, measure the Panel and determine its expected drawing size.
This must call measureElement with each Panel element, which will set the
GraphObject.measuredBounds of those elements. Depending on how the Panel intends to lay out its elements,
the programmer must construction the union
by setting union.width
and union.height
of the supplied argument.
For example PanelLayoutHorizontal measures its elements and sums their widths to set its union.width
,
and takes the maximum of their heights to set its union.height
.
This union must reflect the measured size of the Panel. After measure is called, the Panel class will modify this union Rect, constraining its size by the Panel's GraphObject.desiredSize, GraphObject.minSize, and GraphObject.maxSize, before passing it to arrange.
Panel which called this layout
expected width of the Panel, informed by any containing Panel and by the Panel's own GraphObject.desiredSize, GraphObject.minSize, and GraphObject.maxSize. Often Infinity.
expected height of the Panel.
Array of Panel elements
rectangle to be modified to contain the expected union bounds of every element in the Panel, to be potentially used in arrange.
expected minimum width of the Panel, informed by any containing Panel. Often zero.
expected minimum height of the Panel.
A custom go.PanelLayout that arranges panel elements in rows or columns. A typical use might be:
A customized use might be:
The direction property determines whether the elements are arranged in rows (if 0 or 180) or in columns (if 90 or 270).
Use the spacing property to control how much space there is between elements in a row or column as well as between rows or columns.
This layout respects the go.GraphObject.visible, go.GraphObject.stretch, and go.GraphObject.alignment properties on each element, along with the Panel's go.Panel.defaultStretch, go.Panel.defaultAlignment, and go.Panel.padding properties.
If you want to experiment with this extension, try the Flow PanelLayout sample.