GeezerVison is showing maxgraph.github.io — CellState | @maxgraph/core
Represents the current state of a cell in a given GraphView.
For edges, the edge label position is stored in absoluteOffset.
The size for oversize labels can be retrieved using the boundingBox property of the text field as shown below.
const bbox = state.text?.boundingBox ?? null;
Constructors
constructor
-
Constructs a new object that represents the current state of the given Cell in the specified view.
Returns CellState
Properties
_height
_height: number = 0
Holds the height of the rectangle.
_width
_width: number = 0
Holds the width of the rectangle.
_x
_x: number = 0
Holds the x-coordinate of the point. Default is 0.
_y
_y: number = 0
Holds the y-coordinate of the point. Default is 0.
absoluteOffset
Point that holds the absolute offset.
- For edges, this is the absolute coordinates of the label position.
- For vertices, this is the offset of the label relative to the top, left corner of the vertex.
absolutePoints
absolutePoints: (
Point | null)
[] = []
Holds an array of Point that represent the absolute points of an edge.
cell
Reference to the Cell that is represented by this state.
control
control: Shape | null = null
invalid
invalid: boolean = true
Specifies if the state is invalid.
invalidStyle
invalidStyle: boolean = false
Specifies if the style is invalid.
length
length: number = 0
Caches the length of an edge.
node
node: HTMLElement | null = null
origin
Point that holds the origin for all child cells.
Default
a new empty Point.
point
point: Point | null = null
segments
segments: number[] = []
Array of numbers that represent the cached length of each segment of the edge.
shape
shape: Shape | null = null
Holds the Shape that represents the cell graphically.
terminalDistance
terminalDistance: number = 0
Caches the distance between the end points for an edge.
text
Holds the Text that represents the label of the cell.
This may be null if the cell has no label.
unscaledHeight
unscaledHeight: number = 0
Holds the unscaled height of the state.
unscaledWidth
unscaledWidth: number = 0
Holds the unscaled width of the state.
visibleSourceState
visibleSourceState: CellState | null = null
Caches the visible source terminal state.
visibleTargetState
visibleTargetState: CellState | null = null
Caches the visible target terminal state.
Accessors
x
-
get x(): number
-
set x(x: number): void
y
-
get y(): number
-
set y(y: number): void
Methods
add
-
Adds the given rectangle to this rectangle.
Returns void
clone
-
Returns a clone of this Point.
Returns CellState
destroy
-
Destroys the state and all associated resources.
Returns void
equals
-
Returns true if the given object equals this rectangle.
Returns boolean
getCellBounds
-
Returns the unscaled, untranslated bounds.
getCenterX
-
Returns the x-coordinate of the center point.
Returns number
getCenterY
-
Returns the y-coordinate of the center point.
Returns number
getImageSrc
-
getImageSrc(): string | null
Returns the image URL for the given cell state.
This implementation returns the value stored in the CellStateStyle.image property
of style.
Returns string | null
getIndicatorColor
-
getIndicatorColor(): string | null
getIndicatorGradientColor
getIndicatorImageSrc
-
getIndicatorImageSrc(): string | null
getPerimeterBounds
-
Returns the Rectangle that should be used as the perimeter of the cell.
Parameters
- border: number = 0
Optional border to be added around the perimeter bounds.
- bounds: Rectangle = ...
Optional Rectangle to be used as the initial bounds.
getPoint
-
Returns the top, left corner as a new Point.
getVisibleTerminal
-
getVisibleTerminal(source?: boolean): Cell | null
Returns the visible source or target terminal cell.
Parameters
- source: boolean = false
Boolean that specifies if the source or target cell should be returned.
Returns Cell | null
getVisibleTerminalState
-
getVisibleTerminalState(source?: boolean): CellState
| null
Returns the visible source or target terminal state.
Parameters
- source: boolean = false
Boolean that specifies if the source or target state should be returned.
Returns CellState | null
grow
-
grow(amount: number): void
Grows the rectangle by the given amount, that is, this method subtracts
the given amount from the x- and y-coordinates and adds twice the amount
to the width and height.
Returns void
intersect
-
Changes this rectangle to where it overlaps with the given rectangle.
Returns void
isLoop
-
isLoop(state: CellState
): boolean | null
Returns true if the given cell state is a loop.
Returns boolean | null
isTransparentState
-
isTransparentState(): boolean
Returns true if the given state has no stroke, no fill color and no image.
Returns boolean
rotate90
-
Rotates this rectangle by 90 degree around its center point.
Returns void
setAbsoluteTerminalPoint
-
setAbsoluteTerminalPoint(point: Point | null, isSource?: boolean): void
Sets the first or last point in depending on isSource.
Parameters
- point: Point | null
Point that represents the terminal point.
- isSource: boolean = false
Boolean that specifies if the first or last point should be assigned.
Returns void
setCursor
-
setCursor(cursor: string): void
Sets the given cursor on the shape and text shape.
Returns void
setRect
-
setRect(x: number, y: number, width: number, height: number): void
Sets this rectangle to the specified values
Parameters
- x: number
- y: number
- width: number
- height: number
Returns void
setState
-
setState(state: CellState
): void
Copies all fields from the given state to this state.
Returns void
setVisibleTerminalState
-
setVisibleTerminalState(terminalState: CellState
| null, source?: boolean): void
Sets the visible source or target terminal state.
Parameters
- terminalState: CellState | null
- source: boolean = false
Boolean that specifies if the source or target state should be set.
Returns void
updateCachedBounds
-
updateCachedBounds(): void
StaticfromRectangle
-
Returns a new Rectangle which is a copy of the given rectangle.
On This Page
Constructors
Properties
Accessors
Methods