Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

Properties

changeHandler

changeHandler: any

Variable: changeHandler

Holds the change event listener for later removal.

connectIconOffset

connectIconOffset: mxPoint

Variable: connectIconOffset

Holds the offset for connect icons during connection preview. Default is mxPoint(0, <mxConstants.TOOLTIP_VERTICAL_OFFSET>). Note that placing the icon under the mouse pointer with an offset of (0,0) will affect hit detection.

connectImage

connectImage: mxImage

Variable: connectImage

that is used to trigger the creation of a new connection. This is used in . Default is null.

constraintHandler

constraintHandler: mxConstraintHandler

Variable: constraintHandler

Holds the used for drawing and highlighting constraints.

createTarget

createTarget: boolean

Variable: createTarget

Specifies if should be called if no target was under the mouse for the new connection. Setting this to true means the connection will be drawn as valid if no target is under the mouse, and will be called before the connection is created between the source cell and the newly created vertex in , which can be overridden to create a new target. Default is false.

cursor

cursor: string

Variable: cursor

Specifies the cursor to be used while the handler is active. Default is null.

drillHandler

drillHandler: any

Variable: drillHandler

Holds the drill event listener for later removal.

edgeState

edgeState: mxCellState

Variable: edgeState

Optional that represents the preview edge while the handler is active. This is created in .

enabled

enabled: boolean

Variable: enabled

Specifies if events are handled. Default is true.

error

error: any

Variable: error

Holds the current validation error while connections are being created.

eventListeners

eventListeners: any[]

Variable: eventListeners

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.

eventSource

eventSource: any

Variable: eventSource

Optional source for events. Default is null.

eventsEnabled

eventsEnabled: boolean

Variable: eventsEnabled

Specifies if events can be fired. Default is true.

factoryMethod

factoryMethod: (source: mxCell, target: mxCell, style?: string) => mxCell

Variable: factoryMethod

Function that is used for creating new edges. The function takes the source and target as the first and second argument and returns a new that represents the edge. This is used in .

Type declaration

first

first: mxPoint

Variable: first

Holds the where the mouseDown took place while the handler is active.

graph

graph: mxGraph

Variable: graph

Reference to the enclosing .

ignoreMouseDown

ignoreMouseDown: boolean

Variable: ignoreMouseDown

Specifies if the connection handler should ignore the state of the mouse button when highlighting the source. Default is false, that is, the handler only highlights the source if no button is being pressed.

insertBeforeSource

insertBeforeSource: boolean

Variable: insertBeforeSource

Specifies if new edges should be inserted before the source vertex in the cell hierarchy. Default is false for backwards compatibility.

livePreview

livePreview: boolean

Variable: livePreview

Specifies if the actual shape of the edge state should be used for the preview. Default is false. (Ignored if no edge state is created in .)

marker

marker: any

Variable: marker

Holds the used for finding source and target cells.

mouseDownCounter

mouseDownCounter: number

Variable: mouseDownCounter

Counts the number of mouseDown events since the start. The initial mouse down event counts as 1.

moveIconBack

moveIconBack: boolean

Variable: moveIconBack

Specifies if icons should be moved to the back of the overlay pane. This can be set to true if the icons of the connection handler conflict with other handles, such as the vertex label move handle. Default is false.

moveIconFront

moveIconFront: boolean

Variable: moveIconFront

Specifies if icons should be displayed inside the graph container instead of the overlay pane. This is used for HTML labels on vertices which hide the connect icon. This has precendence over when set to true. Default is false.

movePreviewAway

movePreviewAway: boolean

Variable: movePreviewAway

Switch to enable moving the preview away from the mousepointer. This is required in browsers where the preview cannot be made transparent to events and if the built-in hit detection on the HTML elements in the page should be used. Default is the value of <mxClient.IS_VML>.

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.

select

select: boolean

Variable: select

Specifies if new edges should be selected. Default is true.

sourceConstraint

sourceConstraint: mxConnectionConstraint

targetConnectImage

targetConnectImage: boolean

Variable: targetConnectImage

Specifies if the connect icon should be centered on the target state while connections are being previewed. Default is false.

waypointsEnabled

waypointsEnabled: boolean

Variable: waypointsEnabled

Specifies if single clicks should add waypoints on the new edge. Default is false.

Methods

addListener

  • addListener(name: string, funct: (...args: any[]) => any): void
  • Function: addListener

    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 .

    Parameters

    • name: string
    • funct: (...args: any[]) => any
        • (...args: any[]): any
        • Parameters

          • Rest ...args: any[]

          Returns any

    Returns void

addWaypointForEvent

connect

  • Function: connect

    Connects the given source and target using a new edge. This implementation uses to create the edge.

    Parameters:

    source - that represents the source terminal. target - that represents the target terminal. evt - Mousedown event of the connect gesture. dropTarget - that represents the cell under the mouse when it was released.

    Parameters

    Returns void

convertWaypoint

  • convertWaypoint(point: mxPoint): void

createEdge

  • Function: createEdge

    Creates and returns a new edge using if one exists. If no factory method is defined, then a new default edge is returned. The source and target arguments are informal, the actual connection is setup later by the caller of this function.

    Parameters:

    value - Value to be used for creating the edge. source - that represents the source terminal. target - that represents the target terminal. style - Optional style from the preview edge.

    Parameters

    • Optional value: any
    • Optional source: mxCell
    • Optional target: mxCell
    • Optional style: string

    Returns mxCell

createEdgeState

  • Function: createEdgeState

    Hook to return an which may be used during the preview. This implementation returns null.

    Use the following code to create a preview for an existing edge style:

    (code) graph.connectionHandler.createEdgeState(me) { var edge = graph.createEdge(null, null, null, null, null, 'edgeStyle=elbowEdgeStyle');

    return new mxCellState(this.graph.view, edge, this.graph.getCellStyle(edge)); }; (end)

    Parameters

    Returns mxCellState

createIcons

createMarker

createShape

createTargetVertex

  • createTargetVertex(evt: MouseEvent, source: mxCell): mxCell
  • Function: createTargetVertex

    Hook method for creating new vertices on the fly if no target was under the mouse. This is only called if is true and returns null.

    Parameters:

    evt - Mousedown event of the connect gesture. source - that represents the source terminal.

    Parameters

    • evt: MouseEvent
    • source: mxCell

    Returns mxCell

destroy

  • destroy(): void
  • Function: destroy

    Destroys the handler and all its resources and DOM nodes. This should be called on all instances. It is called automatically for the built-in instance created for each .

    Returns void

destroyIcons

  • destroyIcons(): void

drawPreview

  • drawPreview(): void

fireEvent

  • Function: fireEvent

    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 (see <mxUtils.bind>).

    Example:

    (code) fireEvent(new mxEventObject("eventName", key1, val1, .., keyN, valN)) (end)

    Parameters:

    evt - that represents the event. sender - Optional sender to be passed to the listener. Default value is the return value of .

    Parameters

    Returns void

getAlignmentTolerance

  • getAlignmentTolerance(evt: MouseEvent): number
  • Function: getAlignmentTolerance

    Returns the tolerance for aligning new targets to sources. This returns the grid size / 2.

    Parameters

    • evt: MouseEvent

    Returns number

getConnectImage

  • Function: getConnectImage

    Hook to return the used for the connection icon of the given . This implementation returns .

    Parameters:

    state - whose connect image should be returned.

    Parameters

    Returns mxImage

getEdgeColor

  • getEdgeColor(valid: boolean): string
  • Function: getEdgeColor

    Returns the color used to draw the preview edge. This returns green if there is no edge validation error and red otherwise.

    Parameters:

    valid - Boolean indicating if the color for a valid edge should be returned.

    Parameters

    • valid: boolean

    Returns string

getEdgeWidth

  • getEdgeWidth(valid: boolean): number
  • Function: getEdgeWidth

    Returns the width used to draw the preview edge. This returns 3 if there is no edge validation error and 1 otherwise.

    Parameters:

    valid - Boolean indicating if the width for a valid edge should be returned.

    Parameters

    • valid: boolean

    Returns number

getEventSource

  • getEventSource(): any

getIconPosition

getSourcePerimeterPoint

  • Function: getSourcePerimeterPoint

    Hook to update the icon position(s) based on a mouseOver event. This is an empty implementation.

    Parameters:

    state - that represents the target cell state. next - that represents the next point along the previewed edge. me - that represents the mouse move.

    Parameters

    Returns mxPoint

getTargetPerimeterPoint

init

  • init(): void
  • Function: init

    Initializes the shapes required for this connection handler. This should be invoked if <mxGraph.container> is assigned after the connection handler has been created.

    Returns void

insertEdge

  • Function: insertEdge

    Creates, inserts and returns the new edge for the given parameters. This implementation does only use if is defined, otherwise <mxGraph.insertEdge> will be used.

    Parameters

    Returns mxCell

isCellEnabled

  • isCellEnabled(cell: mxCell): 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

isConnecting

  • isConnecting(): boolean
  • Function: isConnecting

    Returns true if the source terminal has been clicked and a new connection is currently being previewed.

    Returns boolean

isCreateTarget

  • isCreateTarget(evt: Event): boolean

isEnabled

  • isEnabled(): boolean

isEventsEnabled

  • isEventsEnabled(): boolean

isImmediateConnectSource

  • isImmediateConnectSource(state: mxCellState): boolean
  • Function: isImmediateConnectSource

    Returns true if a tap on the given source state should immediately start connecting. This implementation returns true if the state is not movable in the graph.

    Parameters

    Returns boolean

isInsertBefore

  • Function: isInsertBefore

    Returns for non-loops and false for loops.

    Parameters:

    edge - that represents the edge to be inserted. source - that represents the source terminal. target - that represents the target terminal. evt - Mousedown event of the connect gesture. dropTarget - that represents the cell under the mouse when it was released.

    Parameters

    Returns boolean

isMoveIconToFrontForState

  • isMoveIconToFrontForState(state: mxCellState): boolean
  • Function: isMoveIconToFrontForState

    Returns true if the state has a HTML label in the graph's container, otherwise it returns .

    Parameters:

    state - whose connect icons should be returned.

    Parameters

    Returns boolean

isOutlineConnectEvent

isStartEvent

  • Function: isStartEvent

    Returns true if the given mouse down event should start this handler. The This implementation returns true if the event does not force marquee selection, and the currentConstraint and currentFocus of the are not null, or and are not null and is null or and are not null.

    Parameters

    Returns boolean

isStopEvent

  • Function: isStopEvent

    Returns true if the given mouse up event should stop this handler. The connection will be created if is null. Note that this is only called if is true. This implemtation returns true if there is a cell state in the given event.

    Parameters

    Returns void

isValidSource

  • Function: isValidSource

    Returns <mxGraph.isValidSource> for the given source terminal.

    Parameters:

    cell - that represents the source terminal. me - that is associated with this call.

    Parameters

    Returns boolean

isValidTarget

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

    Returns true. The call to <mxGraph.isValidTarget> is implicit by calling <mxGraph.getEdgeValidationError> in . This is an additional hook for disabling certain targets in this specific handler.

    Parameters:

    cell - that represents the target terminal.

    Parameters

    Returns boolean

mouseDown

mouseMove

mouseUp

redrawIcons

removeListener

  • removeListener(funct: (...args: any[]) => any): void
  • Function: removeListener

    Removes all occurrences of the given listener from .

    Parameters

    • funct: (...args: any[]) => any
        • (...args: any[]): any
        • Parameters

          • Rest ...args: any[]

          Returns any

    Returns void

reset

  • reset(): void

selectCells

  • Function: selectCells

    Selects the given edge after adding a new connection. The target argument contains the target vertex if one has been inserted.

    Parameters

    Returns void

setCreateTarget

  • setCreateTarget(value: boolean): void

setEnabled

  • setEnabled(enabled: boolean): void
  • Function: setEnabled

    Enables or disables event handling. This implementation updates .

    Parameters:

    enabled - Boolean that specifies the new enabled state.

    Parameters

    • enabled: boolean

    Returns void

setEventSource

  • setEventSource(value: any): void

setEventsEnabled

  • setEventsEnabled(value: boolean): void

snapToPreview

start

updateCurrentState

updateEdgeState

updateIcons

  • Function: updateIcons

    Hook to update the icon position(s) based on a mouseOver event. This is an empty implementation.

    Parameters:

    state - under the mouse. icons - Array of currently displayed icons. me - that contains the mouse event.

    Parameters

    Returns void

updatePreview

  • updatePreview(valid: boolean): void
  • Function: getEdgeColor

    Returns the color used to draw the preview edge. This returns green if there is no edge validation error and red otherwise.

    Parameters:

    valid - Boolean indicating if the color for a valid edge should be returned.

    Parameters

    • valid: boolean

    Returns void

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