GeezerVison is showing maxgraph.github.io — StackLayout | @maxgraph/core
Extends GraphLayout to create a horizontal or vertical stack of the child vertices.
The children do not need to be connected for this layout to work.
Example:
const layout = new StackLayout(graph, true); layout.execute(graph.getDefaultParent());
Constructors
constructor
-
new StackLayout( graph: AbstractGraph, horizontal?: boolean | null, spacing?: number | null, x0?: number | null, y0?: number | null, border?: number | null,): StackLayout
Parameters
- graph: AbstractGraph
- horizontal: boolean | null = null
- spacing: number | null = null
- x0: number | null = null
- y0: number | null = null
- border: number | null = null
Returns StackLayout
Properties
allowGaps
allowGaps: boolean = false
If gaps should be allowed in the stack.
border
border: number = 0
Border to be added if fill is true.
borderCollapse
borderCollapse: boolean = true
If the strokeWidth should be ignored.
fill
fill: boolean = false
Boolean indicating if dimension should be changed to fill out the parent cell.
gridSize
gridSize: number = 0
Grid size for alignment of position and size.
horizontal
horizontal: boolean
Specifies the orientation of the layout.
keepFirstLocation
keepFirstLocation: boolean = false
Boolean indicating if the location of the first cell should be kept, that is, it will not be moved to x0 or y0.
marginBottom
marginBottom: number = 0
Top margin for the child area.
marginLeft
marginLeft: number = 0
Top margin for the child area.
marginRight
marginRight: number = 0
Top margin for the child area.
marginTop
marginTop: number = 0
Top margin for the child area.
parent
parent: Cell | null = null
The parent cell of the layout, if any
resizeLast
resizeLast: boolean = false
If the last element should be resized to fill out the parent.
resizeParent
resizeParent: boolean = false
If the parent should be resized to match the width/height of the stack.
resizeParentMax
resizeParentMax: boolean = false
Use maximum of existing value and new value for resize of parent.
spacing
spacing: number
Specifies the spacing between the cells.
useBoundingBox
useBoundingBox: boolean = true
Boolean indicating if the bounding box of the label should be used if it iss available.
wrap
wrap: number | null = null
Value at which a new column or row should be created.
x0
x0: number
Specifies the horizontal origin of the layout.
y0
y0: number
Specifies the vertical origin of the layout.
Methods
arrangeGroups
-
arrangeGroups( cells: Cell[], border: number, topBorder: number, rightBorder: number, bottomBorder: number, leftBorder: number,): Cell[]
Parameters
- cells: Cell[]
- border: number
- topBorder: number
- rightBorder: number
- bottomBorder: number
- leftBorder: number
Returns Cell[]
execute
-
execute(parent: Cell): void
Implements mxGraphLayout.execute.
Returns void
getConstraint
-
getConstraint(key: string, cell: Cell, edge?: Cell, source?: boolean): any
Returns the constraint for the given key and cell. The optional edge and
source arguments are used to return inbound and outgoing routing-
constraints for the given edge and vertex. This implementation always
returns the value for the given key in the style of the given cell.
Parameters
- key: string
Key of the constraint to be returned.
- cell: Cell
Cell whose constraint should be returned.
Optionaledge: Cell
Optional Cell that represents the connection whose constraint
should be returned. Default is null.
Optionalsource: boolean
Optional boolean that specifies if the connection is incoming
or outgoing. Default is null.
Returns any
getGraph
-
Returns the graph that this layout operates on.
getLayoutCells
-
Returns the cells to be layouted.
Returns Cell[]
getParentOffset
-
Determines the offset of the given parent to the parent
of the layout
getParentSize
-
Returns the size for the parent container or the size of the graph container if the parent is a layer or the root of the model.
isAncestor
-
isAncestor( parent: Cell, child: Cell | null, traverseAncestors?: boolean,): boolean
Returns true if the given parent is an ancestor of the given child.
Parameters
- parent: Cell
Cell that specifies the parent.
- child: Cell | null
Cell that specifies the child.
OptionaltraverseAncestors: boolean
Returns boolean
isEdgeIgnored
-
isEdgeIgnored(edge: Cell): boolean
Returns a boolean indicating if the given Cell should be ignored by
the algorithm. This implementation returns false for all vertices.
Parameters
- edge: Cell
Cell whose ignored state should be returned.
Returns boolean
isVertexIgnored
-
isVertexIgnored(vertex: Cell): boolean
Returns a boolean indicating if the given Cell should be ignored by
the algorithm. This implementation returns false for all vertices.
Parameters
- vertex: Cell
Cell whose ignored state should be returned.
Returns boolean
isVertexMovable
-
isVertexMovable(cell: Cell): boolean
Returns a boolean indicating if the given Cell is movable or
bendable by the algorithm. This implementation returns true if the given
cell is movable in the graph.
Parameters
- cell: Cell
Cell whose movable state should be returned.
Returns boolean
moveCell
-
moveCell(cell: Cell, x: number, y: number): void
Implements mxGraphLayout.moveCell.
Parameters
- cell: Cell
- x: number
- y: number
Returns void
resizeCell
-
Notified when a cell is being resized in a parent that has automatic
layout to update the other cells in the layout.
Empty implementation.
Returns void
setChildGeometry
-
Sets the specific geometry to the given child cell.
Returns void
setEdgePoints
-
setEdgePoints(edge: Cell, points: Point[] | null): void
Replaces the array of Point in the geometry of the given edge
with the given array of Point.
Returns void
setEdgeStyleEnabled
-
setEdgeStyleEnabled(edge: Cell, value: boolean): void
Disables or enables the edge style of the given edge.
Parameters
- edge: Cell
- value: boolean
Returns void
setOrthogonalEdge
-
setOrthogonalEdge(edge: Cell, value: boolean): void
Disables or enables orthogonal end segments of the given edge.
Parameters
- edge: Cell
- value: boolean
Returns void
setVertexLocation
-
setVertexLocation(cell: Cell, x: number, y: number): Rectangle | null
Sets the new position of the given cell taking into account the size of
the bounding box if useBoundingBox is true. The change is only carried
out if the new location is not equal to the existing location, otherwise
the geometry is not replaced with an updated instance. The new or old
bounds are returned (including overlapping labels).
Parameters
- cell: Cell
Cell whose geometry is to be set.
- x: number
Integer that defines the x-coordinate of the new location.
- y: number
Integer that defines the y-coordinate of the new location.
snap
-
snap(value: number): number
Snaps the given value to the grid size.
Returns number
traverse
-
traverse(vertex: GraphLayoutTraverseArgs): void
Traverses the (directed) graph invoking the given function for each
visited vertex and edge. The function is invoked with the current vertex
and the incoming edge as a parameter. This implementation makes sure
each vertex is only visited once. The function may return false if the
traversal should stop at the given vertex.
Example:
GlobalConfig.logger.show(); const cell = graph.getSelectionCell(); graph.traverse(cell, false, function(vertex, edge) { GlobalConfig.logger.debug(graph.getLabel(vertex)); });
Parameters
- vertex: GraphLayoutTraverseArgs
Cell that represents the vertex where the traversal starts.
Returns void
updateParentGeometry
-
Updates the geometry of the given parent cell.
Returns void
On This Page
Constructors
Properties
Methods
|