GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • @maxgraph/core

This view

  • Original page
  • New address

GeezerVison is showing maxgraph.github.io — CellState | @maxgraph/core

  • CellState

Class CellState

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;

Hierarchy (View Summary)

  • Rectangle
    • CellState
  • Defined in view/cell/CellState.ts:41
Index

Constructors

constructor

Properties

_height _width _x _y absoluteOffset absolutePoints boundingBox cell cellBounds control invalid invalidStyle length node origin overlays paintBounds parentHighlight point segments shape style terminalDistance text unscaledHeight unscaledWidth view visibleSourceState visibleTargetState

Accessors

height width x y

Methods

add clone destroy equals getCellBounds getCenterX getCenterY getImageSrc getIndicatorColor getIndicatorGradientColor getIndicatorImageSrc getIndicatorShape getPaintBounds getPerimeterBounds getPoint getVerticalAlign getVisibleTerminal getVisibleTerminalState grow intersect isLoop isTransparentState rotate90 setAbsoluteTerminalPoint setCursor setRect setState setVisibleTerminalState updateCachedBounds fromRectangle

Constructors

constructor

  • new CellState(
        view?: GraphView | null,
        cell?: Cell | null,
        style?: CellStateStyle | null,
    ): CellState

    Constructs a new object that represents the current state of the given Cell in the specified view.

    Parameters

    • view: GraphView | null = null

      GraphView that contains the state.

    • cell: Cell | null = null

      Cell that this state represents.

    • style: CellStateStyle | null = null

      the style of the Cell.

    Returns CellState

    Overrides Rectangle.constructor

    • Defined in view/cell/CellState.ts:161

Properties

_height

_height: number = 0

Holds the height of the rectangle.

Default

0

Inherited from Rectangle._height

  • Defined in view/geometry/Rectangle.ts:47

_width

_width: number = 0

Holds the width of the rectangle.

Default

0

Inherited from Rectangle._width

  • Defined in view/geometry/Rectangle.ts:41

_x

_x: number = 0

Holds the x-coordinate of the point. Default is 0.

Inherited from Rectangle._x

  • Defined in view/geometry/Point.ts:39

_y

_y: number = 0

Holds the y-coordinate of the point. Default is 0.

Inherited from Rectangle._y

  • Defined in view/geometry/Point.ts:44

absoluteOffset

absoluteOffset: Point

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.
  • Defined in view/cell/CellState.ts:102

absolutePoints

absolutePoints: (Point | null)[] = []

Holds an array of Point that represent the absolute points of an edge.

  • Defined in view/cell/CellState.ts:94

boundingBox

boundingBox: Rectangle | null = null
  • Defined in view/cell/CellState.ts:50

cell

cell: Cell

Reference to the Cell that is represented by this state.

  • Defined in view/cell/CellState.ts:66

cellBounds

cellBounds: Rectangle | null = null
  • Defined in view/cell/CellState.ts:46

control

control: Shape | null = null
  • Defined in view/cell/CellState.ts:53

invalid

invalid: boolean = true

Specifies if the state is invalid.

Default

true
  • Defined in view/cell/CellState.ts:83

invalidStyle

invalidStyle: boolean = false

Specifies if the style is invalid.

Default

false
  • Defined in view/cell/CellState.ts:77

length

length: number = 0

Caches the length of an edge.

  • Defined in view/cell/CellState.ts:122

node

node: HTMLElement | null = null
  • Defined in view/cell/CellState.ts:43

origin

origin: Point

Point that holds the origin for all child cells.

Default

a new empty Point.

  • Defined in view/cell/CellState.ts:89

overlays

overlays: Map<CellOverlay, Shape> = ...
  • Defined in view/cell/CellState.ts:56

paintBounds

paintBounds: Rectangle | null = null
  • Defined in view/cell/CellState.ts:48

parentHighlight

parentHighlight: RectangleShape | null = null
  • Defined in view/cell/CellState.ts:150

point

point: Point | null = null
  • Defined in view/cell/CellState.ts:152

segments

segments: number[] = []

Array of numbers that represent the cached length of each segment of the edge.

  • Defined in view/cell/CellState.ts:127

shape

shape: Shape | null = null

Holds the Shape that represents the cell graphically.

  • Defined in view/cell/CellState.ts:132

style

style: CellStateStyle

The style of the Cell.

  • Defined in view/cell/CellState.ts:71

terminalDistance

terminalDistance: number = 0

Caches the distance between the end points for an edge.

  • Defined in view/cell/CellState.ts:117

text

text: TextShape | null = null

Holds the Text that represents the label of the cell. This may be null if the cell has no label.

  • Defined in view/cell/CellState.ts:138

unscaledHeight

unscaledHeight: number = 0

Holds the unscaled height of the state.

  • Defined in view/cell/CellState.ts:148

unscaledWidth

unscaledWidth: number = 0

Holds the unscaled width of the state.

  • Defined in view/cell/CellState.ts:143

view

view: GraphView

Reference to the enclosing GraphView.

  • Defined in view/cell/CellState.ts:61

visibleSourceState

visibleSourceState: CellState | null = null

Caches the visible source terminal state.

  • Defined in view/cell/CellState.ts:107

visibleTargetState

visibleTargetState: CellState | null = null

Caches the visible target terminal state.

  • Defined in view/cell/CellState.ts:112

Accessors

height

  • get height(): number

    Returns number

    Inherited from Rectangle.height

    • Defined in view/geometry/Rectangle.ts:59
  • set height(height: number): void

    Parameters

    • height: number

    Returns void

    Inherited from Rectangle.height

    • Defined in view/geometry/Rectangle.ts:63

width

  • get width(): number

    Returns number

    Inherited from Rectangle.width

    • Defined in view/geometry/Rectangle.ts:49
  • set width(width: number): void

    Parameters

    • width: number

    Returns void

    Inherited from Rectangle.width

    • Defined in view/geometry/Rectangle.ts:53

x

  • get x(): number

    Returns number

    Inherited from Rectangle.x

    • Defined in view/geometry/Point.ts:46
  • set x(x: number): void

    Parameters

    • x: number

    Returns void

    Inherited from Rectangle.x

    • Defined in view/geometry/Point.ts:50

y

  • get y(): number

    Returns number

    Inherited from Rectangle.y

    • Defined in view/geometry/Point.ts:56
  • set y(y: number): void

    Parameters

    • y: number

    Returns void

    Inherited from Rectangle.y

    • Defined in view/geometry/Point.ts:60

Methods

add

  • add(rect: Rectangle): void

    Adds the given rectangle to this rectangle.

    Parameters

    • rect: Rectangle

    Returns void

    Inherited from Rectangle.add

    • Defined in view/geometry/Rectangle.ts:103

clone

  • clone(): CellState

    Returns a clone of this Point.

    Returns CellState

    Overrides Rectangle.clone

    • Defined in view/cell/CellState.ts:338

destroy

  • destroy(): void

    Destroys the state and all associated resources.

    Returns void

    • Defined in view/cell/CellState.ts:375

equals

  • equals(rect: Rectangle | null): boolean

    Returns true if the given object equals this rectangle.

    Parameters

    • rect: Rectangle | null

    Returns boolean

    Inherited from Rectangle.equals

    • Defined in view/geometry/Rectangle.ts:166

getCellBounds

  • getCellBounds(): Rectangle | null

    Returns the unscaled, untranslated bounds.

    Returns Rectangle | null

    • Defined in view/cell/CellState.ts:282

getCenterX

  • getCenterX(): number

    Returns the x-coordinate of the center point.

    Returns number

    Inherited from Rectangle.getCenterX

    • Defined in view/geometry/Rectangle.ts:89

getCenterY

  • getCenterY(): number

    Returns the y-coordinate of the center point.

    Returns number

    Inherited from Rectangle.getCenterY

    • Defined in view/geometry/Rectangle.ts:96

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

    • Defined in view/cell/CellState.ts:418

getIndicatorColor

  • getIndicatorColor(): string | null

    Returns the indicator color for the given cell state. This implementation returns the value stored in the CellStateStyle.indicatorColor property of style.

    Returns string | null

    • Defined in view/cell/CellState.ts:427

getIndicatorGradientColor

  • getIndicatorGradientColor(): SpecialStyleColorValue | null

    Returns the indicator gradient color for the given cell state. This implementation returns the value stored in the CellStateStyle.gradientColor property of style.

    Returns SpecialStyleColorValue | null

    • Defined in view/cell/CellState.ts:436

getIndicatorImageSrc

  • getIndicatorImageSrc(): string | null

    Returns the indicator image for the given cell state. This implementation returns the value stored in the CellStateStyle.indicatorImage property of style.

    Returns string | null

    • Defined in view/cell/CellState.ts:454

getIndicatorShape

  • getIndicatorShape(): StyleShapeValue | null

    Returns the indicator shape for the given cell state. This implementation returns the value stored in the CellStateStyle.indicatorShape property of style.

    Returns StyleShapeValue | null

    • Defined in view/cell/CellState.ts:445

getPaintBounds

  • getPaintBounds(): Rectangle | null

    Returns the unscaled, untranslated paint bounds.

    This is the same as getCellBounds but with a 90-degrees rotation if the Shape.isPaintBoundsInverted returns true.

    Returns Rectangle | null

    • Defined in view/cell/CellState.ts:291

getPerimeterBounds

  • getPerimeterBounds(border?: number, bounds?: Rectangle): Rectangle

    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.

    Returns Rectangle

    • Defined in view/cell/CellState.ts:186

getPoint

  • getPoint(): Point

    Returns the top, left corner as a new Point.

    Returns Point

    Inherited from Rectangle.getPoint

    • Defined in view/geometry/Rectangle.ts:146

getVerticalAlign

  • getVerticalAlign(): VAlignValue

    Returns the vertical alignment for the given cell state. This implementation returns the value stored in the CellStateStyle.verticalAlign property of style.

    Returns VAlignValue

    • Defined in view/cell/CellState.ts:398

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

    • Defined in view/cell/CellState.ts:252

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

    • Defined in view/cell/CellState.ts:261

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.

    Parameters

    • amount: number

    Returns void

    Inherited from Rectangle.grow

    • Defined in view/geometry/Rectangle.ts:136

intersect

  • intersect(rect: Rectangle): void

    Changes this rectangle to where it overlaps with the given rectangle.

    Parameters

    • rect: Rectangle

    Returns void

    Inherited from Rectangle.intersect

    • Defined in view/geometry/Rectangle.ts:118

isLoop

  • isLoop(state: CellState): boolean | null

    Returns true if the given cell state is a loop.

    Parameters

    • state: CellState

      CellState that represents a potential loop.

    Returns boolean | null

    • Defined in view/cell/CellState.ts:384

isTransparentState

  • isTransparentState(): boolean

    Returns true if the given state has no stroke, no fill color and no image.

    Returns boolean

    • Defined in view/cell/CellState.ts:405

rotate90

  • rotate90(): void

    Rotates this rectangle by 90 degree around its center point.

    Returns void

    Inherited from Rectangle.rotate90

    • Defined in view/geometry/Rectangle.ts:153

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

    • Defined in view/cell/CellState.ts:218

setCursor

  • setCursor(cursor: string): void

    Sets the given cursor on the shape and text shape.

    Parameters

    • cursor: string

    Returns void

    • Defined in view/cell/CellState.ts:238

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

    Inherited from Rectangle.setRect

    • Defined in view/geometry/Rectangle.ts:79

setState

  • setState(state: CellState): void

    Copies all fields from the given state to this state.

    Parameters

    • state: CellState

    Returns void

    • Defined in view/cell/CellState.ts:319

setVisibleTerminalState

  • setVisibleTerminalState(terminalState: CellState | null, source?: boolean): void

    Sets the visible source or target terminal state.

    Parameters

    • terminalState: CellState | null

      CellState that represents the terminal.

    • source: boolean = false

      Boolean that specifies if the source or target state should be set.

    Returns void

    • Defined in view/cell/CellState.ts:271

updateCachedBounds

  • updateCachedBounds(): void

    Updates the cellBounds and paintBounds.

    Returns void

    • Defined in view/cell/CellState.ts:298

StaticfromRectangle

  • fromRectangle(rect: Rectangle): Rectangle

    Returns a new Rectangle which is a copy of the given rectangle.

    Parameters

    • rect: Rectangle

    Returns Rectangle

    Inherited from Rectangle.fromRectangle

    • Defined in view/geometry/Rectangle.ts:72

Settings

Member Visibility
  • Protected
  • Inherited
Theme

On This Page

Constructors
constructor
Properties
_height_width_x_yabsoluteOffsetabsolutePointsboundingBoxcellcellBoundscontrolinvalidinvalidStylelengthnodeoriginoverlayspaintBoundsparentHighlightpointsegmentsshapestyleterminalDistancetextunscaledHeightunscaledWidthviewvisibleSourceStatevisibleTargetState
Accessors
heightwidthxy
Methods
addclonedestroyequalsgetCellBoundsgetCenterXgetCenterYgetImageSrcgetIndicatorColorgetIndicatorGradientColorgetIndicatorImageSrcgetIndicatorShapegetPaintBoundsgetPerimeterBoundsgetPointgetVerticalAligngetVisibleTerminalgetVisibleTerminalStategrowintersectisLoopisTransparentStaterotate90setAbsoluteTerminalPointsetCursorsetRectsetStatesetVisibleTerminalStateupdateCachedBoundsfromRectangle
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.