Options
All
  • Public
  • Public/Protected
  • All
Menu

Graph event handler that reconnects edges and modifies control points and the edge label location. Uses for finding and highlighting new source and target vertices. This handler is automatically created in mxGraph.createHandler for each selected edge. To enable adding/removing control points, the following code can be used

example
mxEdgeHandler.prototype.addEnabled = true;
mxEdgeHandler.prototype.removeEnabled = true;

Note: This experimental feature is not recommended for production use.

Hierarchy

Index

Constructors

constructor

Properties

addEnabled

addEnabled: boolean

Variable: addEnabled

Specifies if adding bends by shift-click is enabled. Default is false. Note: This experimental feature is not recommended for production use.

allowHandleBoundsCheck

allowHandleBoundsCheck: boolean

Variable: allowHandleBoundsCheck

Specifies if the bounds of handles should be used for hit-detection in IE Default is true.

bends

bends: mxShape[]

Variable: bends

Holds the that represent the points.

cloneEnabled

cloneEnabled: boolean

Variable: cloneEnabled

Specifies if cloning by control-drag is enabled. Default is true.

constraintHandler

constraintHandler: mxConstraintHandler

Variable: constraintHandler

Holds the used for drawing and highlighting constraints.

dblClickRemoveEnabled

dblClickRemoveEnabled: boolean

Variable: dblClickRemoveEnabled

Specifies if removing bends by double click is enabled. Default is false.

error

error: string

Variable: error

Holds the current validation error while a connection is being changed.

graph

graph: mxGraph

Variable: graph

Reference to the enclosing .

handleImage

handleImage: mxImage

Variable: handleImage

Optional to be used as handles. Default is null.

labelHandleImage

labelHandleImage: mxImage

labelShape

labelShape: mxShape

Variable: labelShape

Holds the that represents the label position.

manageLabelHandle

manageLabelHandle: boolean

Variable: manageLabelHandle

Specifies if the label handle should be moved if it intersects with another handle. Uses for checking and moving. Default is false.

marker

marker: any

Variable: marker

Holds the which is used for highlighting terminals.

mergeRemoveEnabled

mergeRemoveEnabled: boolean

Variable: mergeRemoveEnabled

Specifies if removing bends by dropping them on other bends is enabled. Default is false.

outlineConnect

outlineConnect: boolean

Variable: outlineConnect

Specifies if connections to the outline of a highlighted target should be enabled. This will allow to place the connection point along the outline of the highlighted target. Default is false.

parentHighlightEnabled

parentHighlightEnabled: boolean

Variable: parentHighlightEnabled

Specifies if the parent should be highlighted if a child cell is selected. Default is false.

preferHtml

preferHtml: boolean

Variable: preferHtml

Specifies if bends should be added to the graph container. This is updated in based on whether the edge or one of its terminals has an HTML label in the container.

removeEnabled

removeEnabled: boolean

Variable: removeEnabled

Specifies if removing bends by shift-click is enabled. Default is false. Note: This experimental feature is not recommended for production use.

shape

shape: mxShape

Variable: shape

Holds the that represents the preview edge.

snapToTerminals

snapToTerminals: boolean

Variable: snapToTerminals

Specifies if waypoints should snap to the routing centers of terminals. Default is false.

state

Variable: state

Reference to the being modified.

straightRemoveEnabled

straightRemoveEnabled: boolean

Variable: straightRemoveEnabled

Specifies if removing bends by creating straight segments should be enabled. If enabled, this can be overridden by holding down the alt key while moving. Default is false.

tolerance

tolerance: number

Variable: tolerance

Optional tolerance for hit-detection in . Default is 0.

virtualBendOpacity

virtualBendOpacity: number

Variable: virtualBendOpacity

Opacity to be used for virtual bends (see ). Default is 20.

virtualBendsEnabled

virtualBendsEnabled: boolean

Variable: virtualBendsEnabled

Specifies if virtual bends should be added in the center of each segments. These bends can then be used to add new waypoints. Default is false.

Methods

addPoint

addPointAt

  • addPointAt(state: mxCellState, x: number, y: number): void

changePoints

changeTerminalPoint

checkLabelHandle

clonePreviewState

connect

  • Function: connect

    Changes the terminal or terminal point of the given edge in the graph model.

    Parameters:

    edge - that represents the edge to be reconnected. terminal - that represents the new terminal. isSource - Boolean indicating if the new terminal is the source or target terminal. isClone - Boolean indicating if the new connection should be a clone of the old edge. me - that contains the mouse up event.

    Parameters

    Returns mxCell

convertPoint

  • convertPoint(point: mxPoint, gridEnabled: boolean): void
  • Function: convertPoint

    Converts the given point in-place from screen to unscaled, untranslated graph coordinates and applies the grid. Returns the given, modified point instance.

    Parameters:

    point - to be converted. gridEnabled - Boolean that specifies if the grid should be applied.

    Parameters

    • point: mxPoint
    • gridEnabled: boolean

    Returns void

createBends

createCustomHandles

  • createCustomHandles(): any[]
  • Function: createCustomHandles

    Returns an array of custom handles. This implementation returns null.

    Returns any[]

createHandleShape

  • Function: createHandleShape

    Creates the shape used to display the given bend. Note that the index may be null for special cases, such as when called from <mxElbowEdgeHandler.createVirtualBend>. Only images and rectangles should be returned if support for HTML labels with not foreign objects is required. Index if null for virtual handles.

    Parameters

    • index: number

    Returns mxRectangleShape

createLabelHandleShape

createMarker

createParentHighlightShape

createSelectionShape

createVirtualBends

destroy

  • destroy(): void
  • Function: destroy

    Destroys the handler and all its resources and DOM nodes. This does normally not need to be called as handlers are destroyed automatically when the corresponding cell is deselected.

    Returns void

destroyBends

  • destroyBends(bends: mxShape[]): void

drawPreview

  • drawPreview(): void

getCellAt

  • getCellAt(x: number, y: number): mxCell

getHandleFillColor

  • getHandleFillColor(index: number): string
  • Function: getHandleFillColor

    Returns the fillcolor for the handle at the given index.

    Parameters

    • index: number

    Returns string

getHandleForEvent

getPointForEvent

getPreviewPoints

  • Function: getPreviewPoints

    Updates the given preview state taking into account the state of the constraint handler.

    Parameters:

    pt - that contains the current pointer position. me - Optional that contains the current event.

    Parameters

    Returns mxPoint[]

getPreviewTerminalState

getSelectionColor

  • getSelectionColor(): string

getSelectionPoints

getSelectionStrokeWidth

  • getSelectionStrokeWidth(): number

getSnapToTerminalTolerance

  • getSnapToTerminalTolerance(): number
  • Function: getSnapToTerminalTolerance

    Returns the tolerance for the guides. Default value is gridSize * scale / 2.

    Returns number

init

  • init(): void

initBend

  • initBend(bend: mxShape, dblClick: (evt: Event) => void): boolean
  • Function: initBend

    Helper method to initialize the given bend.

    Parameters:

    bend - that represents the bend to be initialized.

    Parameters

    • bend: mxShape
    • dblClick: (evt: Event) => void
        • (evt: Event): void
        • Parameters

          • evt: Event

          Returns void

    Returns boolean

isAddPointEvent

  • isAddPointEvent(evt: Event): boolean
  • Function: isAddPointEvent

    Returns true if the given event is a trigger to add a new point. This implementation returns true if shift is pressed.

    Parameters

    • evt: Event

    Returns boolean

isAddVirtualBendEvent

  • Function: isAddVirtualBendEvent

    Returns true if the given event allows virtual bends to be added. This implementation returns true.

    Parameters

    Returns boolean

isConnectableCell

  • isConnectableCell(cell: mxCell): boolean
  • Function: isConnectableCell

    Returns true if the given cell is connectable. This is a hook to disable floating connections. This implementation returns true.

    Parameters

    Returns boolean

isCustomHandleEvent

  • Function: isCustomHandleEvent

    Returns true if the given event allows custom handles to be changed. This implementation returns true.

    Parameters

    Returns boolean

isHandleEnabled

  • isHandleEnabled(index: number): boolean
  • Function: isHandleEnabled

    Creates the shape used to display the given bend.

    Parameters

    • index: number

    Returns boolean

isHandleVisible

  • isHandleVisible(index: number): boolean
  • Function: isHandleVisible

    Returns true if the handle at the given index is visible.

    Parameters

    • index: number

    Returns boolean

isOutlineConnectEvent

  • Function: isOutlineConnectEvent

    Returns true if is true and the source of the event is the outline shape or shift is pressed.

    Parameters

    Returns boolean

isRemovePointEvent

  • isRemovePointEvent(evt: Event): boolean
  • Function: isRemovePointEvent

    Returns true if the given event is a trigger to remove a point. This implementation returns true if shift is pressed.

    Parameters

    • evt: Event

    Returns boolean

isSelectionDashed

  • isSelectionDashed(): boolean

isSnapToTerminalsEvent

isVirtualBendsEnabled

  • isVirtualBendsEnabled(evt: Event): boolean
  • Function: isVirtualBendsEnabled

    Returns true if virtual bends should be added. This returns true if is true and the current style allows and renders custom waypoints.

    Parameters

    • evt: Event

    Returns boolean

mouseDown

  • Function: mouseDown

    Handles the event by checking if a special element of the handler was clicked, in which case the index parameter is non-null. The indices may be one of or the number of the respective control point. The source and target points are used for reconnecting the edge.

    Parameters

    Returns void

mouseMove

mouseUp

moveLabel

  • moveLabel(edgeState: mxCellState, x: number, y: number): void
  • Function: moveLabel

    Changes the coordinates for the label of the given edge.

    Parameters:

    edge - that represents the edge. x - Integer that specifies the x-coordinate of the new location. y - Integer that specifies the y-coordinate of the new location.

    Parameters

    Returns void

redraw

  • redraw(): void

redrawHandles

  • redrawHandles(): void

redrawInnerBends

  • Function: redrawInnerBends

    Updates and redraws the inner bends.

    Parameters:

    p0 - that represents the location of the first point. pe - that represents the location of the last point.

    Parameters

    Returns void

refresh

  • refresh(): void

removeHint

  • removeHint(): void

removePoint

reset

  • reset(): void

roundLength

  • roundLength(length: number): number
  • Function: roundLength

    Hook for rounding the unscaled width or height. This uses Math.round.

    Parameters

    • length: number

    Returns number

setHandlesVisible

  • setHandlesVisible(visible: boolean): void

setPreviewColor

  • setPreviewColor(color: string): void
  • Function: setPreviewColor

    Sets the color of the preview to the given value.

    Parameters

    • color: string

    Returns void

start

  • start(x: number, y: number, index: number): void
  • Function: start

    Starts the handling of the mouse gesture.

    Parameters

    • x: number
    • y: number
    • index: number

    Returns void

updateHint

updatePreviewState

validateConnection

  • validateConnection(source: mxCell, target: mxCell): string
  • Function: validateConnection

    Returns the error message or an empty string if the connection for the given source, target pair is not valid. Otherwise it returns null. This implementation uses <mxGraph.getEdgeValidationError>.

    Parameters:

    source - that represents the source terminal. target - that represents the target terminal.

    Parameters

    Returns string

Generated using TypeDoc