GeezerVison is showing maxgraph.github.io — GraphView | @maxgraph/core
Constructors
Properties
allowEval
allowEval: boolean = false
backgroundPageShape
backgroundPageShape: Shape | null = null
backgroundPane
backgroundPane: HTMLElement | SVGElement
canvas
canvas: HTMLElement | SVGElement
captureDocumentGesture
captureDocumentGesture: boolean = true
Specifies if a gesture should be captured when it goes outside of the
graph container. Default is true.
currentRoot
currentRoot: Cell | null = null
Cell that acts as the root of the displayed cell hierarchy.
decoratorPane
decoratorPane: HTMLElement | SVGElement
doneResource
doneResource: string = ...
Specifies the resource key for the status message after a long operation.
If the resource for this key does not exist then the value is used as
the status message.
drawPane
drawPane: HTMLElement | SVGElement
eventListeners
eventListeners: EventListenerObject[] = []
Holds the event names and associated listeners in an array. The array
contains the event name followed by the respective listener for each
registered listener.
eventsEnabled
eventsEnabled: boolean = true
Specifies if events can be fired. Default is true.
eventSource
eventSource: EventTarget | null = null
Optional source for events.
lastForegroundHtmlNode
lastForegroundHtmlNode: HTMLElement | SVGElement | null = null
During validation, this contains the last edge HTML DOM node that was processed.
lastForegroundNode
lastForegroundNode: HTMLElement | SVGElement | null = null
During validation, this contains the last edge's DOM node that was processed.
lastHtmlNode
lastHtmlNode: HTMLElement | SVGElement | null = null
During validation, this contains the last HTML DOM node that was processed.
lastNode
lastNode: HTMLElement | SVGElement | null = null
During validation, this contains the last DOM node that was processed.
overlayPane
overlayPane: HTMLElement | SVGElement
rendering
rendering: boolean = true
Specifies if shapes should be created, updated and destroyed using the
methods of cellRenderer in graph. Default is true.
translate
Point that specifies the current translation. Default is a new
empty Point.
updateStyle
updateStyle: boolean = false
Specifies if the style should be updated in each validation step. If this
is false then the style is only updated if the state is created or if the
style of the cell was changed. Default is false.
updatingDocumentResource
updatingDocumentResource: string = ...
Specifies the resource key for the status message while the document is
being updated. If the resource for this key does not exist then the
value is used as the status message.
Default'updatingSelection'
Methods
addListener
-
addListener(name: string, funct: Function): void
Binds the specified function to the given event name. If no event name
is given, then the listener is registered for all events.
The parameters of the listener are the sender and an EventObject.
Parameters
- name: string
- funct: Function
Returns void
clear
-
clear(cell?: Cell | null, force?: boolean, recurse?: boolean): void
Removes the state of the given cell and all descendants if the given cell is not the current root.
Parameters
Optionalcell: Cell | null
Optional Cell for which the state should be removed. Default is the root of the model.
- force: boolean = false
Optional boolean indicating if the current root should be ignored for recursion. Default is false.
- recurse: boolean = true
Optional boolean indicating if the descendants should be cleared as well. Default is true.
Returns void
createBackgroundPageShape
-
Creates and returns the shape used as the background page.
createHtml
-
Creates the DOM nodes for the HTML display.
Returns void
createHtmlPane
-
createHtmlPane(width: string, height: string): HTMLElement
Creates and returns a drawing pane in HTML (DIV).
Parameters
- width: string
- height: string
Returns HTMLElement
createState
-
Creates and returns an CellState for the given cell and initializes
it using cellRenderer.initialize.
createSvg
-
Creates and returns the DOM nodes for the SVG display.
Returns void
destroy
-
Destroys the view and all its resources.
Returns void
fireEvent
-
fireEvent(evt: EventObject, sender?: EventTarget | null): void
Dispatches the given event to the listeners which are registered for the event.
The sender argument is optional.
The current execution scope ("this") is used for the listener invocation.
Example:
fireEvent(new EventObject("eventName", key1, val1, .., keyN, valN))
Parameters
- evt: EventObject
- sender: EventTarget | null = null
Optional sender to be passed to the listener. Default value is the return value of getEventSource.
Returns void
getBackgroundPageBounds
-
Returns the bounds for the background page.
getBackgroundPane
-
getBackgroundPane(): HTMLElement | SVGElement
Returns the DOM node that represents the background layer.
Returns HTMLElement | SVGElement
getBoundingBox
-
Returns the bounding box of the shape and the label for the given
CellState and its children if recurse is true.
Parameters
- state: CellState | null = null
CellState whose bounding box should be returned.
- recurse: boolean = true
Optional boolean indicating if the children should be included.
Default is true.
getBounds
-
Parameters
- cells: Cell[]
Array of Cell whose bounds should be returned.
getCanvas
-
getCanvas(): HTMLElement | SVGElement
Returns the DOM node that contains the background-, draw-, overlay- and decorator- panes.
Returns HTMLElement | SVGElement
getCellStates
-
Returns the CellStates for the given array of Cell.
The array contains all states that are not null, that is, the returned array may have fewer elements than the given array.
If no argument is given, then this returns the CellState of states.
Parameters
- cells: Cell[] | null = null
getDecoratorPane
-
getDecoratorPane(): HTMLElement | SVGElement
Returns the DOM node that represents the topmost drawing layer.
Returns HTMLElement | SVGElement
getDrawPane
-
getDrawPane(): HTMLElement | SVGElement
Returns the DOM node that represents the main drawing layer.
Returns HTMLElement | SVGElement
getEdgeStyle
-
Returns the edge style function to be used to render the given edge state.
getEmptyBounds
-
Returns the bounds for an empty graph. This returns a rectangle at
translate with the size of 0 x 0.
getEventSource
-
getEventSource(): EventTarget | null
Returns EventTarget | null
getFixedTerminalPoint
-
Returns the fixed source or target terminal point for the given edge.
Returns Point | null
getFloatingTerminalPoint
-
Returns the floating terminal point for the given edge, start and end
state, where start is the source if source is true.
Parameters
- edge: CellState
CellState whose terminal point should be returned.
- start: CellState
CellState for the terminal on "this" side of the edge.
- end: CellState | null
CellState for the terminal on the other side of the edge.
- source: boolean
Boolean indicating if start is the source terminal state.
Returns Point | null
getNextPoint
-
Returns the nearest point in the list of absolute points or the center
of the opposite terminal.
Parameters
- edge: CellState
- opposite: CellState | null
CellState that represents the opposite terminal.
- source: boolean = false
Boolean indicating if the next point for the source or target
should be returned.
getOverlayPane
-
getOverlayPane(): HTMLElement | SVGElement
Returns the DOM node that represents the layer above the drawing layer.
Returns HTMLElement | SVGElement
getPerimeterBounds
-
Returns the perimeter bounds for the given terminal, edge pair as an
Rectangle.
If you have a model where each terminal has a relative child that should
act as the graphical endpoint for a connection from/to the terminal, then
this method can be replaced as follows:
Parameters
- terminal: CellState
CellState that represents the terminal.
- border: number = 0
Number that adds a border between the shape and the perimeter.
Examplevar oldGetPerimeterBounds = getPerimeterBounds; getPerimeterBounds(terminal, edge, isSource) { var model = this.graph.getDataModel(); var childCount = model.getChildCount(terminal.cell);
if (childCount > 0) { var child = model.getChildAt(terminal.cell, 0); var geo = model.getGeometry(child);
if (geo != null && geo.relative) { var state = this.getState(child);
if (state != null) { terminal = state; } } }
return oldGetPerimeterBounds.apply(this, arguments); };
getPerimeterFunction
-
Returns the perimeter function for the given state.
getPerimeterPoint
-
getPerimeterPoint( terminal: CellState, next: Point, orthogonal: boolean, border?: number,): Point | null
Returns an Point that defines the location of the intersection point between
the perimeter and the line between the center of the shape and the given point.
Parameters
- terminal: CellState
- next: Point
Point that lies outside the given terminal.
- orthogonal: boolean
Boolean that specifies if the orthogonal projection onto
the perimeter should be returned. If this is false then the intersection
of the perimeter and the line between the next and the center point is
returned.
- border: number = 0
Optional border between the perimeter and the shape.
Returns Point | null
getPoint
-
Returns the absolute point on the edge for the given relative
Geometry as an Point. The edge is represented by the given
CellState.
getRelativePoint
-
Gets the relative point that describes the given, absolute label
position for the given edge state.
Parameters
- edgeState: CellState
CellState that represents the state of the parent edge.
- x: number
Specifies the x-coordinate of the absolute label location.
- y: number
Specifies the y-coordinate of the absolute label location.
getRoutingCenterX
-
Returns the x-coordinate of the center point for automatic routing.
Returns number
getRoutingCenterY
-
Returns the y-coordinate of the center point for automatic routing.
Returns number
getState
-
Returns the CellState for the given cell. If create is true, then
the state is created if it does not yet exist.
Parameters
- cell: Cell
- create: boolean = false
Optional boolean indicating if a new state should be created if it does not yet exist. Default is false.
getTerminalPort
-
Returns an CellState that represents the source or target terminal or
port for the given edge.
Parameters
- state: CellState
CellState that represents the state of the edge.
- terminal: CellState
- source: boolean = false
Boolean indicating if the given terminal is the source terminal.
getVisibleTerminal
-
getVisibleTerminal(edge: Cell, source: boolean): Cell | null
Returns the nearest ancestor terminal that is visible. The edge appears
to be connected to this terminal on the display. The result of this method
is cached in CellState.getVisibleTerminalState.
Parameters
- edge: Cell
Cell whose visible terminal should be returned.
- source: boolean
Boolean that specifies if the source or target terminal
should be returned.
Returns Cell | null
init
-
Initializes the graph event dispatch loop for the specified container
and invokes create to create the required DOM nodes for the display.
Returns void
installListeners
-
Installs the required listeners in the container.
Returns void
invalidate
-
invalidate(cell?: Cell | null, recurse?: boolean, includeEdges?: boolean): void
Invalidates the state of the given cell, all its descendants and
connected edges.
Parameters
- cell: Cell | null = null
Optional Cell to be invalidated. Default is the root of the
model.
- recurse: boolean = true
- includeEdges: boolean = true
Returns void
isContainerEvent
-
isContainerEvent(evt: MouseEvent): any
Returns true if the event origin is one of the drawing panes or
containers of the view.
Returns any
isEventsEnabled
-
isEventsEnabled(): boolean
isScrollEvent
-
isScrollEvent(evt: MouseEvent | TouchEvent): boolean
Parameters
- evt: MouseEvent | TouchEvent
Returns boolean
redrawBackgroundImage
-
Updates the bounds and redraws the background image.
Example:
If the background image should not be scaled, this can be replaced with
the following.
Returns void
ExampleredrawBackground(backgroundImage, bg) { backgroundImage.bounds.x = this.translate.x; backgroundImage.bounds.y = this.translate.y; backgroundImage.bounds.width = bg.width; backgroundImage.bounds.height = bg.height;
backgroundImage.redraw(); };
refresh
-
Clears the view if currentRoot is not null and revalidates.
Returns void
removeListener
-
removeListener(funct: Function): void
removeState
-
Removes and returns the CellState for the given cell.
resetValidationState
-
resetValidationState(): void
Resets the current validation state.
Returns void
revalidate
-
Revalidates the complete view with all cell states.
Returns void
scaleAndTranslate
-
scaleAndTranslate(scale: number, dx: number, dy: number): void
Parameters
- scale: number
Decimal value that specifies the new scale (1 is 100%).
- dx: number
X-coordinate of the translation.
- dy: number
Y-coordinate of the translation.
Returns void
setAllowEval
-
setAllowEval(value: boolean): void
setCurrentRoot
-
setCurrentRoot(root: Cell | null): Cell | null
Parameters
- root: Cell | null
Cell that specifies the root of the displayed cell hierarchy.
Returns Cell | null
setEventsEnabled
-
setEventsEnabled(value: boolean): void
setEventSource
-
setEventSource(value: EventTarget | null): void
Parameters
- value: EventTarget | null
Returns void
setRendering
-
setRendering(value: boolean): void
setScale
-
setScale(value: number): void
Parameters
- value: number
Decimal value that specifies the new scale (1 is 100%).
Returns void
setTranslate
-
setTranslate(dx: number, dy: number): void
Parameters
- dx: number
X-coordinate of the translation.
- dy: number
Y-coordinate of the translation.
Returns void
stateValidated
-
Invoked when a state has been processed in validatePoints. This is used
to update the order of the DOM nodes of the shape.
Returns void
transformControlPoint
-
Transforms the given control point to an absolute point.
Returns Point | null
updateBoundsFromStencil
-
Updates the bounds of the given cell state to reflect the bounds of the stencil
if it has a fixed aspect and returns the previous bounds as an Rectangle if
the bounds have been modified or null otherwise.
updateContainerStyle
-
updateContainerStyle(container: HTMLElement): void
Updates the style of the container after installing the SVG DOM elements.
Returns void
updateEdgeLabelOffset
-
updateEdgeLabelOffset(state: CellState): void
Updates CellState.absoluteOffset for the given state. The absolute
offset is normally used for the position of the edge label. It is
calculated from the geometry as an absolute offset from the center
between the two endpoints if the geometry is absolute, or as the
relative distance between the center along the line and the absolute
orthogonal distance if the geometry is relative.
Returns void
updateEdgeState
-
Validates the given cell state.
Returns void
updateFixedTerminalPoint
-
Sets the fixed source or target terminal point on the given edge.
Returns void
updateFixedTerminalPoints
-
Sets the initial absolute terminal points in the given state before the edge
style is computed.
Returns void
updateFloatingTerminalPoint
-
Updates the absolute terminal point in the given state for the given
start and end state, where start is the source if source is true.
Parameters
- edge: CellState
CellState whose terminal point should be updated.
- start: CellState
CellState for the terminal on "this" side of the edge.
- end: CellState | null
CellState for the terminal on the other side of the edge.
- source: boolean
Boolean indicating if start is the source terminal state.
Returns void
updateFloatingTerminalPoints
-
Updates the terminal points in the given state after the edge style was
computed for the edge.
Returns void
updateHtmlCanvasSize
-
updateHtmlCanvasSize(width: number, height: number): void
Updates the size of the HTML canvas.
Parameters
- width: number
- height: number
Returns void
updatePoints
-
Updates the absolute points in the given state using the specified array
of Point as the relative points.
Returns void
updateVertexLabelOffset
-
updateVertexLabelOffset(state: CellState): void
Updates the absoluteOffset of the given vertex cell state. This takes
into account the label position styles.
Returns void
updateVertexState
-
Validates the given cell state.
Returns void
validate
-
validate(cell?: Cell | null): void
Parameters
- cell: Cell | null = null
Optional Cell to be used as the root of the validation.
Default is currentRoot or the root of the model.
Returns void
validateBackground
-
validateBackground(): void
validateBackgroundImage
-
validateBackgroundImage(): void
Validates the background image.
Returns void
validateBackgroundPage
-
validateBackgroundPage(): void
Validates the background page.
Returns void
validateCell
-
validateCell(cell: Cell, visible?: boolean): Cell
Recursively creates the cell state for the given cell if visible is true and
the given cell is visible. If the cell is not visible but the state exists
then it is removed using removeState.
Parameters
- cell: Cell
- visible: boolean = true
Optional boolean indicating if the cell should be visible. Default
is true.
validateCellState
-
validateCellState(cell: Cell | null, recurse?: boolean): CellState | null
Parameters
- cell: Cell | null
- recurse: boolean = true
Optional boolean indicating if the children of the cell should be
validated. Default is true.
On This Page
Constructors
Properties
Methods
|