Extends mxGraphLayout for arranging parallel edges. This layout works on edges for all pairs of vertices where there is more than one edge connecting the latter.
var layout = new mxParallelEdgeLayout(graph); layout.execute(graph.getDefaultParent());
To run the layout for the parallel edges of a changed edge only, the following code can be used.
var layout = new mxParallelEdgeLayout(graph); graph.addListener(mxEvent.CELL_CONNECTED, function(sender, evt) { var model = graph.getModel(); var edge = evt.getProperty('edge'); var src = model.getTerminal(edge, true); var trg = model.getTerminal(edge, false); layout.isEdgeIgnored = function(edge2) { var src2 = model.getTerminal(edge2, true); var trg2 = model.getTerminal(edge2, false); return !(model.isEdge(edge2) && ((src == src2 && trg == trg2) || (src == trg2 && trg == src2))); }; layout.execute(graph.getDefaultParent()); });
mxParallelEdgeLayout | Extends mxGraphLayout for arranging parallel edges. |
Functions | |
mxParallelEdgeLayout | Constructs a new parallel edge layout for the specified graph. |
Variables | |
spacing | Defines the spacing between the parallels. |
checkOverlap | Specifies if only overlapping edges should be considered parallel. |
Functions | |
execute | Implements mxGraphLayout.execute. |
findParallels | Finds the parallel edges in the given parent. |
getEdgeId | Returns a unique ID for the given edge. |
layout | Lays out the parallel edges in the given array. |
route | Routes the given edge via the given point. |
mxParallelEdgeLayout.prototype.execute = function( parent, cells )
Implements mxGraphLayout.execute.
Constructs a new parallel edge layout for the specified graph.
function mxParallelEdgeLayout( graph )
Defines the spacing between the parallels.
mxParallelEdgeLayout.prototype.spacing
Specifies if only overlapping edges should be considered parallel.
mxParallelEdgeLayout.prototype.checkOverlap
Implements mxGraphLayout.execute.
mxParallelEdgeLayout.prototype.execute = function( parent, cells )
Executes the layout algorithm for the children of the given parent.
mxGraphLayout.prototype.execute = function( parent )
Finds the parallel edges in the given parent.
mxParallelEdgeLayout.prototype.findParallels = function( parent, cells )
Returns a unique ID for the given edge.
mxParallelEdgeLayout.prototype.getEdgeId = function( edge )
Lays out the parallel edges in the given array.
mxParallelEdgeLayout.prototype.layout = function( parallels )
Routes the given edge via the given point.
mxParallelEdgeLayout.prototype.route = function( edge, x, y )