Graph event handler that reconnects edges and modifies control points and the edge label location. Uses <mxTerminalMarker> for finding and highlighting new source and target vertices. This handler is automatically created in mxGraph.createHandler for each selected edge.
mxEdgeHandler.prototype.addEnabled = true; mxEdgeHandler.prototype.removeEnabled = true;
Note: This experimental feature is not recommended for production use.
mxEdgeHandler | Graph event handler that reconnects edges and modifies control points and the edge label location. |
Functions | |
mxEdgeHandler | Constructs an edge handler for the specified mxCellState. |
Variables | |
graph | Reference to the enclosing mxGraph. |
state | Reference to the mxCellState being modified. |
marker | Holds the <mxTerminalMarker> which is used for highlighting terminals. |
constraintHandler | Holds the mxConstraintHandler used for drawing and highlighting constraints. |
error | Holds the current validation error while a connection is being changed. |
shape | Holds the mxShape that represents the preview edge. |
bends | Holds the mxShapes that represent the points. |
labelShape | Holds the mxShape that represents the label position. |
cloneEnabled | Specifies if cloning by control-drag is enabled. |
addEnabled | Specifies if adding bends by shift-click is enabled. |
removeEnabled | Specifies if removing bends by shift-click is enabled. |
preferHtml | Specifies if bends should be added to the graph container. |
allowHandleBoundsCheck | Specifies if the bounds of handles should be used for hit-detection in IE Default is true. |
snapToTerminals | Specifies if waypoints should snap to the routing centers of terminals. |
handleImage | Optional mxImage to be used as handles. |
tolerance | Optional tolerance for hit-detection in getHandleForEvent. |
Functions | |
init | Initializes the shapes required for this edge handler. |
isAddPointEvent | Returns true if the given event is a trigger to add a new point. |
isRemovePointEvent | Returns true if the given event is a trigger to remove a point. |
getSelectionPoints | Returns the list of points that defines the selection stroke. |
createSelectionShape | Creates the shape used to draw the selection border. |
getSelectionColor | Returns mxConstants.EDGE_SELECTION_COLOR. |
getSelectionStrokeWidth | Returns mxConstants.EDGE_SELECTION_STROKEWIDTH. |
isSelectionDashed | Returns <mxConstants.EDGE_SELECTION_DASHED>. |
isConnectableCell | Returns true if the given cell is connectable. |
createMarker | Creates and returns the mxCellMarker used in marker. |
validateConnection | Returns the error message or an empty string if the connection for the given source, target pair is not valid. |
createBends | Creates and returns the bends used for modifying the edge. |
isHandleEnabled | Creates the shape used to display the given bend. |
isHandleVisible | Returns true if the handle at the given index is visible. |
createHandleShape | Creates the shape used to display the given bend. |
initBend | Helper method to initialize the given bend. |
getHandleForEvent | Returns the index of the handle for the given event. |
mouseDown | Handles the event by checking if a special element of the handler was clicked, in which case the index parameter is non-null. |
start | Starts the handling of the mouse gesture. |
clonePreviewState | Returns a clone of the current preview state for the given point and terminal. |
getSnapToTerminalTolerance | Returns the tolerance for the guides. |
updateHint | Hook for subclassers do show details while the handler is active. |
removeHint | Hooks for subclassers to hide details when the handler gets inactive. |
roundLength | Hook for rounding the unscaled width or height. |
getPointForEvent | Returns the point for the given event. |
getPreviewTerminalState | Updates the given preview state taking into account the state of the constraint handler. |
getPreviewPoints | Updates the given preview state taking into account the state of the constraint handler. |
updatePreviewState | Updates the given preview state taking into account the state of the constraint handler. |
mouseMove | Handles the event by updating the preview. |
mouseUp | Handles the event to applying the previewed changes on the edge by using moveLabel, connect or changePoints. |
reset | Resets the state of this handler. |
setPreviewColor | Sets the color of the preview to the given value. |
convertPoint | Converts the given point in-place from screen to unscaled, untranslated graph coordinates and applies the grid. |
moveLabel | Changes the coordinates for the label of the given edge. |
connect | Changes the terminal or terminal point of the given edge in the graph model. |
changeTerminalPoint | Changes the terminal point of the given edge. |
changePoints | Changes the control points of the given edge in the graph model. |
addPoint | Adds a control point for the given state and event. |
addPointAt | Adds a control point at the given point. |
removePoint | Removes the control point at the given index from the given state. |
getHandleFillColor | Returns the fillcolor for the handle at the given index. |
redraw | Redraws the preview, and the bends- and label control points. |
redrawHandles | Redraws the handles. |
redrawInnerBends | Updates and redraws the inner bends. |
drawPreview | Redraws the preview. |
refresh | Refreshes the bends of this handler. |
destroyBends | Destroys all elements in bends. |
destroy | Destroys the handler and all its resources and DOM nodes. |
function mxEdgeHandler( state )
Constructs an edge handler for the specified mxCellState.
state | mxCellState of the cell to be handled. |
mxEdgeHandler.prototype.graph
Reference to the enclosing mxGraph.
mxEdgeHandler.prototype.state
Reference to the mxCellState being modified.
mxEdgeHandler.prototype.constraintHandler
Holds the mxConstraintHandler used for drawing and highlighting constraints.
mxEdgeHandler.prototype.shape
Holds the mxShape that represents the preview edge.
mxEdgeHandler.prototype.bends
Holds the mxShapes that represent the points.
mxEdgeHandler.prototype.labelShape
Holds the mxShape that represents the label position.
mxEdgeHandler.prototype.preferHtml
Specifies if bends should be added to the graph container. This is updated in init based on whether the edge or one of its terminals has an HTML label in the container.
mxEdgeHandler.prototype.handleImage
Optional mxImage to be used as handles. Default is null.
mxEdgeHandler.prototype.tolerance
Optional tolerance for hit-detection in getHandleForEvent. Default is 0.
mxEdgeHandler.prototype.getSelectionColor = function()
Returns mxConstants.EDGE_SELECTION_COLOR.
mxEdgeHandler.prototype.createMarker = function()
Creates and returns the mxCellMarker used in marker.
mxEdgeHandler.prototype.validateConnection = function( source, target )
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.
source | mxCell that represents the source terminal. |
target | mxCell that represents the target terminal. |
mxEdgeHandler.prototype.createBends = function()
Creates and returns the bends used for modifying the edge. This is typically an array of mxRectangleShapes.
mxEdgeHandler.prototype.createHandleShape = function( index )
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.
mxEdgeHandler.prototype.initBend = function( bend )
Helper method to initialize the given bend.
bend | mxShape that represents the bend to be initialized. |
mxEdgeHandler.prototype.mouseDown = function( sender, me )
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 <LABEL_HANDLE> or the number of the respective control point. The source and target points are used for reconnecting the edge.
mxEdgeHandler.prototype.mouseUp = function( sender, me )
Handles the event to applying the previewed changes on the edge by using moveLabel, connect or changePoints.
mxEdgeHandler.prototype.convertPoint = function( point, gridEnabled )
Converts the given point in-place from screen to unscaled, untranslated graph coordinates and applies the grid. Returns the given, modified point instance.
point | mxPoint to be converted. |
gridEnabled | Boolean that specifies if the grid should be applied. |
mxEdgeHandler.prototype.moveLabel = function( edgeState, x, y )
Changes the coordinates for the label of the given edge.
edge | mxCell 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. |
mxEdgeHandler.prototype.connect = function( edge, terminal, isSource, isClone, me )
Changes the terminal or terminal point of the given edge in the graph model.
edge | mxCell that represents the edge to be reconnected. |
terminal | mxCell 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 | mxMouseEvent that contains the mouse up event. |
mxEdgeHandler.prototype.destroyBends = function()
Destroys all elements in bends.
Constructs an edge handler for the specified mxCellState.
function mxEdgeHandler( state )
Reference to the enclosing mxGraph.
mxEdgeHandler.prototype.graph
Reference to the mxCellState being modified.
mxEdgeHandler.prototype.state
Holds the mxTerminalMarker which is used for highlighting terminals.
mxEdgeHandler.prototype.marker
Holds the mxConstraintHandler used for drawing and highlighting constraints.
mxEdgeHandler.prototype.constraintHandler
Holds the current validation error while a connection is being changed.
mxEdgeHandler.prototype.error
Holds the mxShape that represents the preview edge.
mxEdgeHandler.prototype.shape
Holds the mxShapes that represent the points.
mxEdgeHandler.prototype.bends
Holds the mxShape that represents the label position.
mxEdgeHandler.prototype.labelShape
Specifies if cloning by control-drag is enabled.
mxEdgeHandler.prototype.cloneEnabled
Specifies if adding bends by shift-click is enabled.
mxEdgeHandler.prototype.addEnabled
Specifies if removing bends by shift-click is enabled.
mxEdgeHandler.prototype.removeEnabled
Specifies if bends should be added to the graph container.
mxEdgeHandler.prototype.preferHtml
Specifies if the bounds of handles should be used for hit-detection in IE Default is true.
mxEdgeHandler.prototype.allowHandleBoundsCheck
Specifies if waypoints should snap to the routing centers of terminals.
mxEdgeHandler.prototype.snapToTerminals
Optional mxImage to be used as handles.
mxEdgeHandler.prototype.handleImage
Optional tolerance for hit-detection in getHandleForEvent.
mxEdgeHandler.prototype.tolerance
Returns the index of the handle for the given event.
mxEdgeHandler.prototype.getHandleForEvent = function( me )
Initializes the shapes required for this edge handler.
mxEdgeHandler.prototype.init = function()
Returns true if the given event is a trigger to add a new point.
mxEdgeHandler.prototype.isAddPointEvent = function( evt )
Returns true if the given event is a trigger to remove a point.
mxEdgeHandler.prototype.isRemovePointEvent = function( evt )
Returns the list of points that defines the selection stroke.
mxEdgeHandler.prototype.getSelectionPoints = function( state )
Creates the shape used to draw the selection border.
mxEdgeHandler.prototype.createSelectionShape = function( points )
Returns mxConstants.EDGE_SELECTION_COLOR.
mxEdgeHandler.prototype.getSelectionColor = function()
Returns mxConstants.EDGE_SELECTION_STROKEWIDTH.
mxEdgeHandler.prototype.getSelectionStrokeWidth = function()
Returns mxConstants.EDGE_SELECTION_DASHED.
mxEdgeHandler.prototype.isSelectionDashed = function()
Returns true if the given cell is connectable.
mxEdgeHandler.prototype.isConnectableCell = function( cell )
Creates and returns the mxCellMarker used in marker.
mxEdgeHandler.prototype.createMarker = function()
Returns the error message or an empty string if the connection for the given source, target pair is not valid.
mxEdgeHandler.prototype.validateConnection = function( source, target )
Creates and returns the bends used for modifying the edge.
mxEdgeHandler.prototype.createBends = function()
Creates the shape used to display the given bend.
mxEdgeHandler.prototype.isHandleEnabled = function( index )
Returns true if the handle at the given index is visible.
mxEdgeHandler.prototype.isHandleVisible = function( index )
Creates the shape used to display the given bend.
mxEdgeHandler.prototype.createHandleShape = function( index )
Helper method to initialize the given bend.
mxEdgeHandler.prototype.initBend = function( bend )
Handles the event by checking if a special element of the handler was clicked, in which case the index parameter is non-null.
mxEdgeHandler.prototype.mouseDown = function( sender, me )
Starts the handling of the mouse gesture.
mxEdgeHandler.prototype.start = function( x, y, index )
Returns a clone of the current preview state for the given point and terminal.
mxEdgeHandler.prototype.clonePreviewState = function( point, terminal )
Returns the tolerance for the guides.
mxEdgeHandler.prototype.getSnapToTerminalTolerance = function()
Hook for subclassers do show details while the handler is active.
mxEdgeHandler.prototype.updateHint = function( me, point )
Hooks for subclassers to hide details when the handler gets inactive.
mxEdgeHandler.prototype.removeHint = function()
Hook for rounding the unscaled width or height.
mxEdgeHandler.prototype.roundLength = function( length )
Returns the point for the given event.
mxEdgeHandler.prototype.getPointForEvent = function( me )
Updates the given preview state taking into account the state of the constraint handler.
mxEdgeHandler.prototype.getPreviewTerminalState = function( me )
Updates the given preview state taking into account the state of the constraint handler.
mxEdgeHandler.prototype.getPreviewPoints = function( point )
Updates the given preview state taking into account the state of the constraint handler.
mxEdgeHandler.prototype.updatePreviewState = function( edge, point, terminalState )
Handles the event by updating the preview.
mxEdgeHandler.prototype.mouseMove = function( sender, me )
Handles the event to applying the previewed changes on the edge by using moveLabel, connect or changePoints.
mxEdgeHandler.prototype.mouseUp = function( sender, me )
Changes the coordinates for the label of the given edge.
mxEdgeHandler.prototype.moveLabel = function( edgeState, x, y )
Changes the terminal or terminal point of the given edge in the graph model.
mxEdgeHandler.prototype.connect = function( edge, terminal, isSource, isClone, me )
Changes the control points of the given edge in the graph model.
mxEdgeHandler.prototype.changePoints = function( edge, points )
Resets the state of this handler.
mxEdgeHandler.prototype.reset = function()
Sets the color of the preview to the given value.
mxEdgeHandler.prototype.setPreviewColor = function( color )
Converts the given point in-place from screen to unscaled, untranslated graph coordinates and applies the grid.
mxEdgeHandler.prototype.convertPoint = function( point, gridEnabled )
Changes the terminal point of the given edge.
mxEdgeHandler.prototype.changeTerminalPoint = function( edge, point, isSource )
Adds a control point for the given state and event.
mxEdgeHandler.prototype.addPoint = function( state, evt )
Adds a control point at the given point.
mxEdgeHandler.prototype.addPointAt = function( state, x, y )
Removes the control point at the given index from the given state.
mxEdgeHandler.prototype.removePoint = function( state, index )
Returns the fillcolor for the handle at the given index.
mxEdgeHandler.prototype.getHandleFillColor = function( index )
Redraws the preview, and the bends- and label control points.
mxEdgeHandler.prototype.redraw = function()
Redraws the handles.
mxEdgeHandler.prototype.redrawHandles = function()
Updates and redraws the inner bends.
mxEdgeHandler.prototype.redrawInnerBends = function( p0, pe )
Redraws the preview.
mxEdgeHandler.prototype.drawPreview = function()
Refreshes the bends of this handler.
mxEdgeHandler.prototype.refresh = function()
Destroys all elements in bends.
mxEdgeHandler.prototype.destroyBends = function()
Destroys the handler and all its resources and DOM nodes.
mxEdgeHandler.prototype.destroy = function()
Creates a new handler for the given cell state.
mxGraph.prototype.createHandler = function( state )
Returns the validation error message to be displayed when inserting or changing an edges’ connectivity.
mxGraph.prototype.getEdgeValidationError = function( edge, source, target )
Creates a virtual bend that supports double clicking and calls mxGraph.flipEdge.
mxElbowEdgeHandler.prototype.createVirtualBend = function()