Given the panel and its list of elements, arrange each element.
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. This Rect can be used to right-align or center-align, etc, elements within an area.
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.
Arranges the GraphObject onto its parent Panel. The passed-in numbers typically account for GraphObject.margin and other offsets. This sets GraphObject.actualBounds.
GraphObject to be arranged.
The final x value of actualBounds that the Panel computes for the GraphObject.
The final y value of actualBounds that the Panel computes for the GraphObject.
The final width value of actualBounds that the Panel computes for the GraphObject.
The final height value of actualBounds that the Panel computes for the GraphObject.
an optional area to constrain this actualBounds to when picking and drawing. By default, this is only used with Fixed/Table panels element, provided as a Rect.
Given the available size, measure the Panel and determine its expected drawing size. Sets the measuredBounds of the object.
This must call measureElement with each Panel element.
This must also construct the union.width and union.height of the passed in union Rect argument. This union must reflect the measured size of the panel.
Panel which called this layout
expected width of the panel
expected width of the panel
Array of Panel elements
rectangle to contain the expected union bounds of every element in the Panel. Useful for arrange.
minimum width of the panel
minimum height of the panel
Given the available size, measure one element of the Panel and determine its expected drawing size. Sets the measuredBounds of the object.
Panel which called this layout
expected width of the GraphObject
expected width of the GraphObject
minimum width of the GraphObject
minimum height of the GraphObject
This is the abstract base class for all Panel Layouts, which inform the possible Panel types. It is possible to create your own Panel type by creating a subclass of PanelLayout, though this is not common and not recommended for beginners.
By default, GoJS has 12 panel types, each corresponding to a PanelLayout subclass:
'Position', PanelLayoutPosition
'Horizontal', PanelLayoutHorizontal
'Vertical', PanelLayoutVertical
'Spot', PanelLayoutSpot
'Auto', PanelLayoutAuto
'Table', PanelLayoutTable
'Viewbox', PanelLayoutViewbox
'TableRow', PanelLayoutTableRow
'TableColumn', PanelLayoutTableColumn
'Link', PanelLayoutLink
'Grid', PanelLayoutGrid
'Graduated', PanelLayoutGraduated
These are included by default in builds of
go.js
andgo-debug.js
. When building from source, you can optionally exclude all of them exceptPosition
,Vertical
,Auto
,Link
, andGrid
. This is demonstrated inminimalSource
andmaximalSource
, in the/projects
folder.Adding a new Layout is done by calling the static function, Panel.definePanelLayout:
Panel.definePanelLayout('Table', new PanelLayoutTable());
Each PanelLayout defines a measure and arrange routine. The measure routine must call measureElement with each element of the Panel, and the arrange routine must similarly call arrangeElement with each element of the Panel.
There is an example PanelLayout in the PanelLayout sample.
2.0