manual js syntax updates
parent
249e8bea6e
commit
c5e7813b34
|
@ -0,0 +1,77 @@
|
|||
class WeightedCellSorter {
|
||||
/**
|
||||
* Variable: weightedValue
|
||||
*
|
||||
* The weighted value of the cell stored.
|
||||
*/
|
||||
weightedValue = 0;
|
||||
|
||||
/**
|
||||
* Variable: nudge
|
||||
*
|
||||
* Whether or not to flip equal weight values.
|
||||
*/
|
||||
nudge = false;
|
||||
|
||||
/**
|
||||
* Variable: visited
|
||||
*
|
||||
* Whether or not this cell has been visited in the current assignment.
|
||||
*/
|
||||
visited = false;
|
||||
|
||||
/**
|
||||
* Variable: rankIndex
|
||||
*
|
||||
* The index this cell is in the model rank.
|
||||
*/
|
||||
rankIndex = null;
|
||||
|
||||
/**
|
||||
* Variable: cell
|
||||
*
|
||||
* The cell whose median value is being calculated.
|
||||
*/
|
||||
cell = null;
|
||||
|
||||
/**
|
||||
* Class: WeightedCellSorter
|
||||
*
|
||||
* A utility class used to track cells whilst sorting occurs on the weighted
|
||||
* sum of their connected edges. Does not violate (x.compareTo(y)==0) ==
|
||||
* (x.equals(y))
|
||||
*
|
||||
* Constructor: WeightedCellSorter
|
||||
*
|
||||
* Constructs a new weighted cell sorted for the given cell and weight.
|
||||
*/
|
||||
constructor(cell, weightedValue) {
|
||||
this.cell = cell;
|
||||
this.weightedValue = weightedValue;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: compare
|
||||
*
|
||||
* Compares two WeightedCellSorters.
|
||||
*/
|
||||
compare = (a, b) => {
|
||||
if (a != null && b != null) {
|
||||
if (b.weightedValue > a.weightedValue) {
|
||||
return -1;
|
||||
} else if (b.weightedValue < a.weightedValue) {
|
||||
return 1;
|
||||
} else {
|
||||
if (b.nudge) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default WeightedCellSorter;
|
File diff suppressed because it is too large
Load Diff
|
@ -2,100 +2,89 @@
|
|||
* Copyright (c) 2006-2015, JGraph Ltd
|
||||
* Copyright (c) 2006-2015, Gaudenz Alder
|
||||
*/
|
||||
/**
|
||||
* Class: mxCompositeLayout
|
||||
*
|
||||
* Allows to compose multiple layouts into a single layout. The master layout
|
||||
* is the layout that handles move operations if another layout than the first
|
||||
* element in <layouts> should be used. The <master> layout is not executed as
|
||||
* the code assumes that it is part of <layouts>.
|
||||
*
|
||||
* Example:
|
||||
* (code)
|
||||
* var first = new mxFastOrganicLayout(graph);
|
||||
* var second = new mxParallelEdgeLayout(graph);
|
||||
* var layout = new mxCompositeLayout(graph, [first, second], first);
|
||||
* layout.execute(graph.getDefaultParent());
|
||||
* (end)
|
||||
*
|
||||
* Constructor: mxCompositeLayout
|
||||
*
|
||||
* Constructs a new layout using the given layouts. The graph instance is
|
||||
* required for creating the transaction that contains all layouts.
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* graph - Reference to the enclosing <mxGraph>.
|
||||
* layouts - Array of <mxGraphLayouts>.
|
||||
* master - Optional layout that handles moves. If no layout is given then
|
||||
* the first layout of the above array is used to handle moves.
|
||||
*/
|
||||
function mxCompositeLayout(graph, layouts, master)
|
||||
{
|
||||
mxGraphLayout.call(this, graph);
|
||||
this.layouts = layouts;
|
||||
this.master = master;
|
||||
};
|
||||
|
||||
/**
|
||||
* Extends mxGraphLayout.
|
||||
*/
|
||||
mxCompositeLayout.prototype = new mxGraphLayout();
|
||||
constructor = mxCompositeLayout;
|
||||
|
||||
/**
|
||||
* Variable: layouts
|
||||
*
|
||||
* Holds the array of <mxGraphLayouts> that this layout contains.
|
||||
*/
|
||||
layouts = null;
|
||||
class mxCompositeLayout extends mxGraphLayout{
|
||||
/**
|
||||
* Variable: layouts
|
||||
*
|
||||
* Holds the array of <mxGraphLayouts> that this layout contains.
|
||||
*/
|
||||
layouts = null;
|
||||
|
||||
/**
|
||||
* Variable: master
|
||||
*
|
||||
* Reference to the <mxGraphLayouts> that handles moves. If this is null
|
||||
* then the first layout in <layouts> is used.
|
||||
*/
|
||||
master = null;
|
||||
/**
|
||||
* Variable: master
|
||||
*
|
||||
* Reference to the <mxGraphLayouts> that handles moves. If this is null
|
||||
* then the first layout in <layouts> is used.
|
||||
*/
|
||||
master = null;
|
||||
|
||||
/**
|
||||
* Function: moveCell
|
||||
*
|
||||
* Implements <mxGraphLayout.moveCell> by calling move on <master> or the first
|
||||
* layout in <layouts>.
|
||||
*/
|
||||
moveCell = (cell, x, y)=>
|
||||
{
|
||||
if (this.master != null)
|
||||
{
|
||||
this.master.moveCell.apply(this.master, arguments);
|
||||
/**
|
||||
* Class: mxCompositeLayout
|
||||
*
|
||||
* Allows to compose multiple layouts into a single layout. The master layout
|
||||
* is the layout that handles move operations if another layout than the first
|
||||
* element in <layouts> should be used. The <master> layout is not executed as
|
||||
* the code assumes that it is part of <layouts>.
|
||||
*
|
||||
* Example:
|
||||
* (code)
|
||||
* var first = new mxFastOrganicLayout(graph);
|
||||
* var second = new mxParallelEdgeLayout(graph);
|
||||
* var layout = new mxCompositeLayout(graph, [first, second], first);
|
||||
* layout.execute(graph.getDefaultParent());
|
||||
* (end)
|
||||
*
|
||||
* Constructor: mxCompositeLayout
|
||||
*
|
||||
* Constructs a new layout using the given layouts. The graph instance is
|
||||
* required for creating the transaction that contains all layouts.
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* graph - Reference to the enclosing <mxGraph>.
|
||||
* layouts - Array of <mxGraphLayouts>.
|
||||
* master - Optional layout that handles moves. If no layout is given then
|
||||
* the first layout of the above array is used to handle moves.
|
||||
*/
|
||||
constructor(graph, layouts, master) {
|
||||
super(graph);
|
||||
this.layouts = layouts;
|
||||
this.master = master;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.layouts[0].moveCell.apply(this.layouts[0], arguments);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: execute
|
||||
*
|
||||
* Implements <mxGraphLayout.execute> by executing all <layouts> in a
|
||||
* single transaction.
|
||||
*/
|
||||
execute = (parent)=>
|
||||
{
|
||||
var model = this.graph.getModel();
|
||||
|
||||
model.beginUpdate();
|
||||
try
|
||||
{
|
||||
for (var i = 0; i < this.layouts.length; i++)
|
||||
{
|
||||
this.layouts[i].execute.apply(this.layouts[i], arguments);
|
||||
/**
|
||||
* Function: moveCell
|
||||
*
|
||||
* Implements <mxGraphLayout.moveCell> by calling move on <master> or the first
|
||||
* layout in <layouts>.
|
||||
*/
|
||||
moveCell=(cell, x, y)=>{
|
||||
if (this.master != null) {
|
||||
this.master.moveCell.apply(this.master, arguments);
|
||||
} else {
|
||||
this.layouts[0].moveCell.apply(this.layouts[0], arguments);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
model.endUpdate();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: execute
|
||||
*
|
||||
* Implements <mxGraphLayout.execute> by executing all <layouts> in a
|
||||
* single transaction.
|
||||
*/
|
||||
execute=(parent)=>{
|
||||
var model = this.graph.getModel();
|
||||
|
||||
model.beginUpdate();
|
||||
try {
|
||||
for (var i = 0; i < this.layouts.length; i++) {
|
||||
this.layouts[i].execute.apply(this.layouts[i], arguments);
|
||||
}
|
||||
} finally {
|
||||
model.endUpdate();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default mxCompositeLayout;
|
||||
|
|
|
@ -2,164 +2,141 @@
|
|||
* Copyright (c) 2006-2015, JGraph Ltd
|
||||
* Copyright (c) 2006-2015, Gaudenz Alder
|
||||
*/
|
||||
/**
|
||||
* Class: mxEdgeLabelLayout
|
||||
*
|
||||
* Extends <mxGraphLayout> to implement an edge label layout. This layout
|
||||
* makes use of cell states, which means the graph must be validated in
|
||||
* a graph view (so that the label bounds are available) before this layout
|
||||
* can be executed.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* (code)
|
||||
* var layout = new mxEdgeLabelLayout(graph);
|
||||
* layout.execute(graph.getDefaultParent());
|
||||
* (end)
|
||||
*
|
||||
* Constructor: mxEdgeLabelLayout
|
||||
*
|
||||
* Constructs a new edge label layout.
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* graph - <mxGraph> that contains the cells.
|
||||
*/
|
||||
function mxEdgeLabelLayout(graph, radius)
|
||||
{
|
||||
mxGraphLayout.call(this, graph);
|
||||
};
|
||||
|
||||
/**
|
||||
* Extends mxGraphLayout.
|
||||
*/
|
||||
mxEdgeLabelLayout.prototype = new mxGraphLayout();
|
||||
constructor = mxEdgeLabelLayout;
|
||||
import mxPoint from "FIXME";
|
||||
|
||||
/**
|
||||
* Function: execute
|
||||
*
|
||||
* Implements <mxGraphLayout.execute>.
|
||||
*/
|
||||
execute = (parent)=>
|
||||
{
|
||||
var view = this.graph.view;
|
||||
var model = this.graph.getModel();
|
||||
|
||||
// Gets all vertices and edges inside the parent
|
||||
var edges = [];
|
||||
var vertices = [];
|
||||
var childCount = model.getChildCount(parent);
|
||||
|
||||
for (var i = 0; i < childCount; i++)
|
||||
{
|
||||
var cell = model.getChildAt(parent, i);
|
||||
var state = view.getState(cell);
|
||||
|
||||
if (state != null)
|
||||
{
|
||||
if (!this.isVertexIgnored(cell))
|
||||
{
|
||||
vertices.push(state);
|
||||
}
|
||||
else if (!this.isEdgeIgnored(cell))
|
||||
{
|
||||
edges.push(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.placeLabels(vertices, edges);
|
||||
};
|
||||
class mxEdgeLabelLayout extends mxGraphLayout {
|
||||
/**
|
||||
* Class: mxEdgeLabelLayout
|
||||
*
|
||||
* Extends <mxGraphLayout> to implement an edge label layout. This layout
|
||||
* makes use of cell states, which means the graph must be validated in
|
||||
* a graph view (so that the label bounds are available) before this layout
|
||||
* can be executed.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* (code)
|
||||
* var layout = new mxEdgeLabelLayout(graph);
|
||||
* layout.execute(graph.getDefaultParent());
|
||||
* (end)
|
||||
*
|
||||
* Constructor: mxEdgeLabelLayout
|
||||
*
|
||||
* Constructs a new edge label layout.
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* graph - <mxGraph> that contains the cells.
|
||||
*/
|
||||
constructor(graph, radius) {
|
||||
super(graph);
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: placeLabels
|
||||
*
|
||||
* Places the labels of the given edges.
|
||||
*/
|
||||
placeLabels = (v, e)=>
|
||||
{
|
||||
var model = this.graph.getModel();
|
||||
|
||||
// Moves the vertices to build a circle. Makes sure the
|
||||
// radius is large enough for the vertices to not
|
||||
// overlap
|
||||
model.beginUpdate();
|
||||
try
|
||||
{
|
||||
for (var i = 0; i < e.length; i++)
|
||||
{
|
||||
var edge = e[i];
|
||||
|
||||
if (edge != null && edge.text != null &&
|
||||
edge.text.boundingBox != null)
|
||||
{
|
||||
for (var j = 0; j < v.length; j++)
|
||||
{
|
||||
var vertex = v[j];
|
||||
|
||||
if (vertex != null)
|
||||
{
|
||||
this.avoid(edge, vertex);
|
||||
}
|
||||
/**
|
||||
* Function: execute
|
||||
*
|
||||
* Implements <mxGraphLayout.execute>.
|
||||
*/
|
||||
execute = (parent) => {
|
||||
var view = this.graph.view;
|
||||
var model = this.graph.getModel();
|
||||
|
||||
// Gets all vertices and edges inside the parent
|
||||
var edges = [];
|
||||
var vertices = [];
|
||||
var childCount = model.getChildCount(parent);
|
||||
|
||||
for (var i = 0; i < childCount; i++) {
|
||||
var cell = model.getChildAt(parent, i);
|
||||
var state = view.getState(cell);
|
||||
|
||||
if (state != null) {
|
||||
if (!this.isVertexIgnored(cell)) {
|
||||
vertices.push(state);
|
||||
} else if (!this.isEdgeIgnored(cell)) {
|
||||
edges.push(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
model.endUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: avoid
|
||||
*
|
||||
* Places the labels of the given edges.
|
||||
*/
|
||||
avoid = (edge, vertex)=>
|
||||
{
|
||||
var model = this.graph.getModel();
|
||||
var labRect = edge.text.boundingBox;
|
||||
|
||||
if (mxUtils.intersects(labRect, vertex))
|
||||
{
|
||||
var dy1 = -labRect.y - labRect.height + vertex.y;
|
||||
var dy2 = -labRect.y + vertex.y + vertex.height;
|
||||
|
||||
var dy = (Math.abs(dy1) < Math.abs(dy2)) ? dy1 : dy2;
|
||||
|
||||
var dx1 = -labRect.x - labRect.width + vertex.x;
|
||||
var dx2 = -labRect.x + vertex.x + vertex.width;
|
||||
|
||||
var dx = (Math.abs(dx1) < Math.abs(dx2)) ? dx1 : dx2;
|
||||
|
||||
if (Math.abs(dx) < Math.abs(dy))
|
||||
{
|
||||
dy = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dx = 0;
|
||||
}
|
||||
|
||||
var g = model.getGeometry(edge.cell);
|
||||
|
||||
if (g != null)
|
||||
{
|
||||
g = g.clone();
|
||||
|
||||
if (g.offset != null)
|
||||
{
|
||||
g.offset.x += dx;
|
||||
g.offset.y += dy;
|
||||
this.placeLabels(vertices, edges);
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: placeLabels
|
||||
*
|
||||
* Places the labels of the given edges.
|
||||
*/
|
||||
placeLabels = (v, e) => {
|
||||
var model = this.graph.getModel();
|
||||
|
||||
// Moves the vertices to build a circle. Makes sure the
|
||||
// radius is large enough for the vertices to not
|
||||
// overlap
|
||||
model.beginUpdate();
|
||||
try {
|
||||
for (var i = 0; i < e.length; i++) {
|
||||
var edge = e[i];
|
||||
|
||||
if (edge != null && edge.text != null &&
|
||||
edge.text.boundingBox != null) {
|
||||
for (var j = 0; j < v.length; j++) {
|
||||
var vertex = v[j];
|
||||
|
||||
if (vertex != null) {
|
||||
this.avoid(edge, vertex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g.offset = new mxPoint(dx, dy);
|
||||
}
|
||||
|
||||
model.setGeometry(edge.cell, g);
|
||||
} finally {
|
||||
model.endUpdate();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: avoid
|
||||
*
|
||||
* Places the labels of the given edges.
|
||||
*/
|
||||
avoid = (edge, vertex) => {
|
||||
var model = this.graph.getModel();
|
||||
var labRect = edge.text.boundingBox;
|
||||
|
||||
if (mxUtils.intersects(labRect, vertex)) {
|
||||
var dy1 = -labRect.y - labRect.height + vertex.y;
|
||||
var dy2 = -labRect.y + vertex.y + vertex.height;
|
||||
|
||||
var dy = (Math.abs(dy1) < Math.abs(dy2)) ? dy1 : dy2;
|
||||
|
||||
var dx1 = -labRect.x - labRect.width + vertex.x;
|
||||
var dx2 = -labRect.x + vertex.x + vertex.width;
|
||||
|
||||
var dx = (Math.abs(dx1) < Math.abs(dx2)) ? dx1 : dx2;
|
||||
|
||||
if (Math.abs(dx) < Math.abs(dy)) {
|
||||
dy = 0;
|
||||
} else {
|
||||
dx = 0;
|
||||
}
|
||||
|
||||
var g = model.getGeometry(edge.cell);
|
||||
|
||||
if (g != null) {
|
||||
g = g.clone();
|
||||
|
||||
if (g.offset != null) {
|
||||
g.offset.x += dx;
|
||||
g.offset.y += dy;
|
||||
} else {
|
||||
g.offset = new mxPoint(dx, dy);
|
||||
}
|
||||
|
||||
model.setGeometry(edge.cell, g);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default mxEdgeLabelLayout;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -2,269 +2,239 @@
|
|||
* Copyright (c) 2006-2015, JGraph Ltd
|
||||
* Copyright (c) 2006-2015, Gaudenz Alder
|
||||
*/
|
||||
/**
|
||||
* Class: mxParallelEdgeLayout
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* (code)
|
||||
* var layout = new mxParallelEdgeLayout(graph);
|
||||
* layout.execute(graph.getDefaultParent());
|
||||
* (end)
|
||||
*
|
||||
* To run the layout for the parallel edges of a changed edge only, the
|
||||
* following code can be used.
|
||||
*
|
||||
* (code)
|
||||
* var layout = new mxParallelEdgeLayout(graph);
|
||||
*
|
||||
* graph.addListener(mxEvent.CELL_CONNECTED, (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 = (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());
|
||||
* });
|
||||
* (end)
|
||||
*
|
||||
* Constructor: mxParallelEdgeLayout
|
||||
*
|
||||
* Constructs a new parallel edge layout for the specified graph.
|
||||
*/
|
||||
function mxParallelEdgeLayout(graph)
|
||||
{
|
||||
mxGraphLayout.call(this, graph);
|
||||
};
|
||||
|
||||
/**
|
||||
* Extends mxGraphLayout.
|
||||
*/
|
||||
mxParallelEdgeLayout.prototype = new mxGraphLayout();
|
||||
constructor = mxParallelEdgeLayout;
|
||||
import mxPoint from "FIXME";
|
||||
|
||||
/**
|
||||
* Variable: spacing
|
||||
*
|
||||
* Defines the spacing between the parallels. Default is 20.
|
||||
*/
|
||||
spacing = 20;
|
||||
class mxParallelEdgeLayout extends mxGraphLayout {
|
||||
/**
|
||||
* Variable: spacing
|
||||
*
|
||||
* Defines the spacing between the parallels. Default is 20.
|
||||
*/
|
||||
spacing = 20;
|
||||
|
||||
/**
|
||||
* Variable: checkOverlap
|
||||
*
|
||||
* Specifies if only overlapping edges should be considered
|
||||
* parallel. Default is false.
|
||||
*/
|
||||
checkOverlap = false;
|
||||
/**
|
||||
* Variable: checkOverlap
|
||||
*
|
||||
* Specifies if only overlapping edges should be considered
|
||||
* parallel. Default is false.
|
||||
*/
|
||||
checkOverlap = false;
|
||||
|
||||
/**
|
||||
* Function: execute
|
||||
*
|
||||
* Implements <mxGraphLayout.execute>.
|
||||
*/
|
||||
execute = (parent, cells)=>
|
||||
{
|
||||
var lookup = this.findParallels(parent, cells);
|
||||
/**
|
||||
* Class: mxParallelEdgeLayout
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* (code)
|
||||
* var layout = new mxParallelEdgeLayout(graph);
|
||||
* layout.execute(graph.getDefaultParent());
|
||||
* (end)
|
||||
*
|
||||
* To run the layout for the parallel edges of a changed edge only, the
|
||||
* following code can be used.
|
||||
*
|
||||
* (code)
|
||||
* var layout = new mxParallelEdgeLayout(graph);
|
||||
*
|
||||
* graph.addListener(mxEvent.CELL_CONNECTED, (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 = (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());
|
||||
* });
|
||||
* (end)
|
||||
*
|
||||
* Constructor: mxParallelEdgeLayout
|
||||
*
|
||||
* Constructs a new parallel edge layout for the specified graph.
|
||||
*/
|
||||
constructor(graph) {
|
||||
super(graph);
|
||||
};
|
||||
|
||||
this.graph.model.beginUpdate();
|
||||
try
|
||||
{
|
||||
for (var i in lookup)
|
||||
{
|
||||
var parallels = lookup[i];
|
||||
/**
|
||||
* Function: execute
|
||||
*
|
||||
* Implements <mxGraphLayout.execute>.
|
||||
*/
|
||||
execute = (parent, cells) => {
|
||||
var lookup = this.findParallels(parent, cells);
|
||||
|
||||
if (parallels.length > 1)
|
||||
{
|
||||
this.layout(parallels);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.graph.model.endUpdate();
|
||||
}
|
||||
};
|
||||
this.graph.model.beginUpdate();
|
||||
try {
|
||||
for (var i in lookup) {
|
||||
var parallels = lookup[i];
|
||||
|
||||
/**
|
||||
* Function: findParallels
|
||||
*
|
||||
* Finds the parallel edges in the given parent.
|
||||
*/
|
||||
findParallels = (parent, cells)=>
|
||||
{
|
||||
var lookup = [];
|
||||
|
||||
var addCell = mxUtils.bind(this, (cell)=>
|
||||
{
|
||||
if (!this.isEdgeIgnored(cell))
|
||||
{
|
||||
var id = this.getEdgeId(cell);
|
||||
|
||||
if (id != null)
|
||||
{
|
||||
if (lookup[id] == null)
|
||||
{
|
||||
lookup[id] = [];
|
||||
if (parallels.length > 1) {
|
||||
this.layout(parallels);
|
||||
}
|
||||
|
||||
lookup[id].push(cell);
|
||||
}
|
||||
} finally {
|
||||
this.graph.model.endUpdate();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (cells != null)
|
||||
{
|
||||
for (var i = 0; i < cells.length; i++)
|
||||
{
|
||||
addCell(cells[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var model = this.graph.getModel();
|
||||
var childCount = model.getChildCount(parent);
|
||||
/**
|
||||
* Function: findParallels
|
||||
*
|
||||
* Finds the parallel edges in the given parent.
|
||||
*/
|
||||
findParallels = (parent, cells) => {
|
||||
var lookup = [];
|
||||
|
||||
for (var i = 0; i < childCount; i++)
|
||||
{
|
||||
addCell(model.getChildAt(parent, i));
|
||||
}
|
||||
}
|
||||
var addCell = mxUtils.bind(this, (cell) => {
|
||||
if (!this.isEdgeIgnored(cell)) {
|
||||
var id = this.getEdgeId(cell);
|
||||
|
||||
return lookup;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: getEdgeId
|
||||
*
|
||||
* Returns a unique ID for the given edge. The id is independent of the
|
||||
* edge direction and is built using the visible terminal of the given
|
||||
* edge.
|
||||
*/
|
||||
getEdgeId = (edge)=>
|
||||
{
|
||||
var view = this.graph.getView();
|
||||
|
||||
// Cannot used cached visible terminal because this could be triggered in BEFORE_UNDO
|
||||
var src = view.getVisibleTerminal(edge, true);
|
||||
var trg = view.getVisibleTerminal(edge, false);
|
||||
var pts = '';
|
||||
|
||||
if (src != null && trg != null)
|
||||
{
|
||||
src = mxObjectIdentity.get(src);
|
||||
trg = mxObjectIdentity.get(trg);
|
||||
|
||||
if (this.checkOverlap)
|
||||
{
|
||||
var state = this.graph.view.getState(edge);
|
||||
|
||||
if (state != null && state.absolutePoints != null)
|
||||
{
|
||||
var tmp = [];
|
||||
|
||||
for (var i = 0; i < state.absolutePoints.length; i++)
|
||||
{
|
||||
var pt = state.absolutePoints[i];
|
||||
|
||||
if (pt != null)
|
||||
{
|
||||
tmp.push(pt.x, pt.y);
|
||||
if (id != null) {
|
||||
if (lookup[id] == null) {
|
||||
lookup[id] = [];
|
||||
}
|
||||
|
||||
lookup[id].push(cell);
|
||||
}
|
||||
|
||||
pts = tmp.join(',');
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
return ((src > trg) ? trg + '-' + src : src + '-' + trg) + pts;
|
||||
}
|
||||
if (cells != null) {
|
||||
for (var i = 0; i < cells.length; i++) {
|
||||
addCell(cells[i]);
|
||||
}
|
||||
} else {
|
||||
var model = this.graph.getModel();
|
||||
var childCount = model.getChildCount(parent);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: layout
|
||||
*
|
||||
* Lays out the parallel edges in the given array.
|
||||
*/
|
||||
layout = (parallels)=>
|
||||
{
|
||||
var edge = parallels[0];
|
||||
var view = this.graph.getView();
|
||||
var model = this.graph.getModel();
|
||||
var src = model.getGeometry(view.getVisibleTerminal(edge, true));
|
||||
var trg = model.getGeometry(view.getVisibleTerminal(edge, false));
|
||||
|
||||
// Routes multiple loops
|
||||
if (src == trg)
|
||||
{
|
||||
var x0 = src.x + src.width + this.spacing;
|
||||
var y0 = src.y + src.height / 2;
|
||||
|
||||
for (var i = 0; i < parallels.length; i++)
|
||||
{
|
||||
this.route(parallels[i], x0, y0);
|
||||
x0 += this.spacing;
|
||||
for (var i = 0; i < childCount; i++) {
|
||||
addCell(model.getChildAt(parent, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (src != null && trg != null)
|
||||
{
|
||||
// Routes parallel edges
|
||||
var scx = src.x + src.width / 2;
|
||||
var scy = src.y + src.height / 2;
|
||||
|
||||
var tcx = trg.x + trg.width / 2;
|
||||
var tcy = trg.y + trg.height / 2;
|
||||
return lookup;
|
||||
};
|
||||
|
||||
var dx = tcx - scx;
|
||||
var dy = tcy - scy;
|
||||
/**
|
||||
* Function: getEdgeId
|
||||
*
|
||||
* Returns a unique ID for the given edge. The id is independent of the
|
||||
* edge direction and is built using the visible terminal of the given
|
||||
* edge.
|
||||
*/
|
||||
getEdgeId = (edge) => {
|
||||
var view = this.graph.getView();
|
||||
|
||||
var len = Math.sqrt(dx * dx + dy * dy);
|
||||
// Cannot used cached visible terminal because this could be triggered in BEFORE_UNDO
|
||||
var src = view.getVisibleTerminal(edge, true);
|
||||
var trg = view.getVisibleTerminal(edge, false);
|
||||
var pts = '';
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
var x0 = scx + dx / 2;
|
||||
var y0 = scy + dy / 2;
|
||||
if (src != null && trg != null) {
|
||||
src = mxObjectIdentity.get(src);
|
||||
trg = mxObjectIdentity.get(trg);
|
||||
|
||||
var nx = dy * this.spacing / len;
|
||||
var ny = dx * this.spacing / len;
|
||||
if (this.checkOverlap) {
|
||||
var state = this.graph.view.getState(edge);
|
||||
|
||||
x0 += nx * (parallels.length - 1) / 2;
|
||||
y0 -= ny * (parallels.length - 1) / 2;
|
||||
if (state != null && state.absolutePoints != null) {
|
||||
var tmp = [];
|
||||
|
||||
for (var i = 0; i < parallels.length; i++)
|
||||
{
|
||||
for (var i = 0; i < state.absolutePoints.length; i++) {
|
||||
var pt = state.absolutePoints[i];
|
||||
|
||||
if (pt != null) {
|
||||
tmp.push(pt.x, pt.y);
|
||||
}
|
||||
}
|
||||
|
||||
pts = tmp.join(',');
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
return ((src > trg) ? trg + '-' + src : src + '-' + trg) + pts;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: layout
|
||||
*
|
||||
* Lays out the parallel edges in the given array.
|
||||
*/
|
||||
layout = (parallels) => {
|
||||
var edge = parallels[0];
|
||||
var view = this.graph.getView();
|
||||
var model = this.graph.getModel();
|
||||
var src = model.getGeometry(view.getVisibleTerminal(edge, true));
|
||||
var trg = model.getGeometry(view.getVisibleTerminal(edge, false));
|
||||
|
||||
// Routes multiple loops
|
||||
if (src == trg) {
|
||||
var x0 = src.x + src.width + this.spacing;
|
||||
var y0 = src.y + src.height / 2;
|
||||
|
||||
for (var i = 0; i < parallels.length; i++) {
|
||||
this.route(parallels[i], x0, y0);
|
||||
x0 -= nx;
|
||||
y0 += ny;
|
||||
x0 += this.spacing;
|
||||
}
|
||||
} else if (src != null && trg != null) {
|
||||
// Routes parallel edges
|
||||
var scx = src.x + src.width / 2;
|
||||
var scy = src.y + src.height / 2;
|
||||
|
||||
var tcx = trg.x + trg.width / 2;
|
||||
var tcy = trg.y + trg.height / 2;
|
||||
|
||||
var dx = tcx - scx;
|
||||
var dy = tcy - scy;
|
||||
|
||||
var len = Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
if (len > 0) {
|
||||
var x0 = scx + dx / 2;
|
||||
var y0 = scy + dy / 2;
|
||||
|
||||
var nx = dy * this.spacing / len;
|
||||
var ny = dx * this.spacing / len;
|
||||
|
||||
x0 += nx * (parallels.length - 1) / 2;
|
||||
y0 -= ny * (parallels.length - 1) / 2;
|
||||
|
||||
for (var i = 0; i < parallels.length; i++) {
|
||||
this.route(parallels[i], x0, y0);
|
||||
x0 -= nx;
|
||||
y0 += ny;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: route
|
||||
*
|
||||
* Routes the given edge via the given point.
|
||||
*/
|
||||
route = (edge, x, y)=>
|
||||
{
|
||||
if (this.graph.isCellMovable(edge))
|
||||
{
|
||||
this.setEdgePoints(edge, [new mxPoint(x, y)]);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Function: route
|
||||
*
|
||||
* Routes the given edge via the given point.
|
||||
*/
|
||||
route = (edge, x, y) => {
|
||||
if (this.graph.isCellMovable(edge)) {
|
||||
this.setEdgePoints(edge, [new mxPoint(x, y)]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default mxParallelEdgeLayout;
|
||||
|
|
|
@ -2,239 +2,234 @@
|
|||
* Copyright (c) 2006-2015, JGraph Ltd
|
||||
* Copyright (c) 2006-2015, Gaudenz Alder
|
||||
*/
|
||||
/**
|
||||
* Class: mxPartitionLayout
|
||||
*
|
||||
* Extends <mxGraphLayout> for partitioning the parent cell vertically or
|
||||
* horizontally by filling the complete area with the child cells. A horizontal
|
||||
* layout partitions the height of the given parent whereas a a non-horizontal
|
||||
* layout partitions the width. If the parent is a layer (that is, a child of
|
||||
* the root node), then the current graph size is partitioned. The children do
|
||||
* not need to be connected for this layout to work.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* (code)
|
||||
* var layout = new mxPartitionLayout(graph, true, 10, 20);
|
||||
* layout.execute(graph.getDefaultParent());
|
||||
* (end)
|
||||
*
|
||||
* Constructor: mxPartitionLayout
|
||||
*
|
||||
* Constructs a new stack layout layout for the specified graph,
|
||||
* spacing, orientation and offset.
|
||||
*/
|
||||
function mxPartitionLayout(graph, horizontal, spacing, border)
|
||||
{
|
||||
mxGraphLayout.call(this, graph);
|
||||
this.horizontal = (horizontal != null) ? horizontal : true;
|
||||
this.spacing = spacing || 0;
|
||||
this.border = border || 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Extends mxGraphLayout.
|
||||
*/
|
||||
mxPartitionLayout.prototype = new mxGraphLayout();
|
||||
constructor = mxPartitionLayout;
|
||||
import mxRectangle from "FIXME";
|
||||
|
||||
/**
|
||||
* Variable: horizontal
|
||||
*
|
||||
* Boolean indicating the direction in which the space is partitioned.
|
||||
* Default is true.
|
||||
*/
|
||||
horizontal = null;
|
||||
class mxPartitionLayout extends mxGraphLayout {
|
||||
/**
|
||||
* Variable: horizontal
|
||||
*
|
||||
* Boolean indicating the direction in which the space is partitioned.
|
||||
* Default is true.
|
||||
*/
|
||||
horizontal = null;
|
||||
|
||||
/**
|
||||
* Variable: spacing
|
||||
*
|
||||
* Integer that specifies the absolute spacing in pixels between the
|
||||
* children. Default is 0.
|
||||
*/
|
||||
spacing = null;
|
||||
/**
|
||||
* Variable: spacing
|
||||
*
|
||||
* Integer that specifies the absolute spacing in pixels between the
|
||||
* children. Default is 0.
|
||||
*/
|
||||
spacing = null;
|
||||
|
||||
/**
|
||||
* Variable: border
|
||||
*
|
||||
* Integer that specifies the absolute inset in pixels for the parent that
|
||||
* contains the children. Default is 0.
|
||||
*/
|
||||
border = null;
|
||||
/**
|
||||
* Variable: border
|
||||
*
|
||||
* Integer that specifies the absolute inset in pixels for the parent that
|
||||
* contains the children. Default is 0.
|
||||
*/
|
||||
border = null;
|
||||
|
||||
/**
|
||||
* Variable: resizeVertices
|
||||
*
|
||||
* Boolean that specifies if vertices should be resized. Default is true.
|
||||
*/
|
||||
resizeVertices = true;
|
||||
/**
|
||||
* Variable: resizeVertices
|
||||
*
|
||||
* Boolean that specifies if vertices should be resized. Default is true.
|
||||
*/
|
||||
resizeVertices = true;
|
||||
|
||||
/**
|
||||
* Function: isHorizontal
|
||||
*
|
||||
* Returns <horizontal>.
|
||||
*/
|
||||
isHorizontal = ()=>
|
||||
{
|
||||
return this.horizontal;
|
||||
};
|
||||
/**
|
||||
* Class: mxPartitionLayout
|
||||
*
|
||||
* Extends <mxGraphLayout> for partitioning the parent cell vertically or
|
||||
* horizontally by filling the complete area with the child cells. A horizontal
|
||||
* layout partitions the height of the given parent whereas a a non-horizontal
|
||||
* layout partitions the width. If the parent is a layer (that is, a child of
|
||||
* the root node), then the current graph size is partitioned. The children do
|
||||
* not need to be connected for this layout to work.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* (code)
|
||||
* var layout = new mxPartitionLayout(graph, true, 10, 20);
|
||||
* layout.execute(graph.getDefaultParent());
|
||||
* (end)
|
||||
*
|
||||
* Constructor: mxPartitionLayout
|
||||
*
|
||||
* Constructs a new stack layout layout for the specified graph,
|
||||
* spacing, orientation and offset.
|
||||
*/
|
||||
constructor(graph, horizontal, spacing, border) {
|
||||
super(graph);
|
||||
this.horizontal = (horizontal != null) ? horizontal : true;
|
||||
this.spacing = spacing || 0;
|
||||
this.border = border || 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: moveCell
|
||||
*
|
||||
* Implements <mxGraphLayout.moveCell>.
|
||||
*/
|
||||
moveCell = (cell, x, y)=>
|
||||
{
|
||||
var model = this.graph.getModel();
|
||||
var parent = model.getParent(cell);
|
||||
/**
|
||||
* Function: isHorizontal
|
||||
*
|
||||
* Returns <horizontal>.
|
||||
*/
|
||||
isHorizontal=()=>{
|
||||
return this.horizontal;
|
||||
};
|
||||
|
||||
if (cell != null &&
|
||||
parent != null)
|
||||
{
|
||||
var i = 0;
|
||||
var last = 0;
|
||||
var childCount = model.getChildCount(parent);
|
||||
/**
|
||||
* Function: moveCell
|
||||
*
|
||||
* Implements <mxGraphLayout.moveCell>.
|
||||
*/
|
||||
moveCell = (cell, x, y)=>{
|
||||
var model = this.graph.getModel();
|
||||
var parent = model.getParent(cell);
|
||||
|
||||
// Finds index of the closest swimlane
|
||||
// TODO: Take into account the orientation
|
||||
for (i = 0; i < childCount; i++)
|
||||
{
|
||||
var child = model.getChildAt(parent, i);
|
||||
var bounds = this.getVertexBounds(child);
|
||||
if (cell != null &&
|
||||
parent != null) {
|
||||
var i = 0;
|
||||
var last = 0;
|
||||
var childCount = model.getChildCount(parent);
|
||||
|
||||
if (bounds != null)
|
||||
// Finds index of the closest swimlane
|
||||
// TODO: Take into account the orientation
|
||||
for (i = 0; i < childCount; i++)
|
||||
{
|
||||
var tmp = bounds.x + bounds.width / 2;
|
||||
var child = model.getChildAt(parent, i);
|
||||
var bounds = this.getVertexBounds(child);
|
||||
|
||||
if (last < x && tmp > x)
|
||||
if (bounds != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
var tmp = bounds.x + bounds.width / 2;
|
||||
|
||||
last = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
// Changes child order in parent
|
||||
var idx = parent.getIndex(cell);
|
||||
idx = Math.max(0, i - ((i > idx) ? 1 : 0));
|
||||
|
||||
model.add(parent, cell, idx);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: execute
|
||||
*
|
||||
* Implements <mxGraphLayout.execute>. All children where <isVertexIgnored>
|
||||
* returns false and <isVertexMovable> returns true are modified.
|
||||
*/
|
||||
execute = (parent)=>
|
||||
{
|
||||
var horizontal = this.isHorizontal();
|
||||
var model = this.graph.getModel();
|
||||
var pgeo = model.getGeometry(parent);
|
||||
|
||||
// Handles special case where the parent is either a layer with no
|
||||
// geometry or the current root of the view in which case the size
|
||||
// of the graph's container will be used.
|
||||
if (this.graph.container != null &&
|
||||
((pgeo == null &&
|
||||
model.isLayer(parent)) ||
|
||||
parent == this.graph.getView().currentRoot))
|
||||
{
|
||||
var width = this.graph.container.offsetWidth - 1;
|
||||
var height = this.graph.container.offsetHeight - 1;
|
||||
pgeo = new mxRectangle(0, 0, width, height);
|
||||
}
|
||||
|
||||
if (pgeo != null)
|
||||
{
|
||||
var children = [];
|
||||
var childCount = model.getChildCount(parent);
|
||||
|
||||
for (var i = 0; i < childCount; i++)
|
||||
{
|
||||
var child = model.getChildAt(parent, i);
|
||||
|
||||
if (!this.isVertexIgnored(child) &&
|
||||
this.isVertexMovable(child))
|
||||
{
|
||||
children.push(child);
|
||||
}
|
||||
}
|
||||
|
||||
var n = children.length;
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
var x0 = this.border;
|
||||
var y0 = this.border;
|
||||
var other = (horizontal) ? pgeo.height : pgeo.width;
|
||||
other -= 2 * this.border;
|
||||
|
||||
var size = (this.graph.isSwimlane(parent)) ?
|
||||
this.graph.getStartSize(parent) :
|
||||
new mxRectangle();
|
||||
|
||||
other -= (horizontal) ? size.height : size.width;
|
||||
x0 = x0 + size.width;
|
||||
y0 = y0 + size.height;
|
||||
|
||||
var tmp = this.border + (n - 1) * this.spacing;
|
||||
var value = (horizontal) ?
|
||||
((pgeo.width - x0 - tmp) / n) :
|
||||
((pgeo.height - y0 - tmp) / n);
|
||||
|
||||
// Avoids negative values, that is values where the sum of the
|
||||
// spacing plus the border is larger then the available space
|
||||
if (value > 0)
|
||||
{
|
||||
model.beginUpdate();
|
||||
try
|
||||
{
|
||||
for (var i = 0; i < n; i++)
|
||||
if (last < x && tmp > x)
|
||||
{
|
||||
var child = children[i];
|
||||
var geo = model.getGeometry(child);
|
||||
break;
|
||||
}
|
||||
|
||||
if (geo != null)
|
||||
last = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
// Changes child order in parent
|
||||
var idx = parent.getIndex(cell);
|
||||
idx = Math.max(0, i - ((i > idx) ? 1 : 0));
|
||||
|
||||
model.add(parent, cell, idx);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Function: execute
|
||||
*
|
||||
* Implements <mxGraphLayout.execute>. All children where <isVertexIgnored>
|
||||
* returns false and <isVertexMovable> returns true are modified.
|
||||
*/
|
||||
execute = (parent)=>
|
||||
{
|
||||
var horizontal = this.isHorizontal();
|
||||
var model = this.graph.getModel();
|
||||
var pgeo = model.getGeometry(parent);
|
||||
|
||||
// Handles special case where the parent is either a layer with no
|
||||
// geometry or the current root of the view in which case the size
|
||||
// of the graph's container will be used.
|
||||
if (this.graph.container != null &&
|
||||
((pgeo == null &&
|
||||
model.isLayer(parent)) ||
|
||||
parent == this.graph.getView().currentRoot))
|
||||
{
|
||||
var width = this.graph.container.offsetWidth - 1;
|
||||
var height = this.graph.container.offsetHeight - 1;
|
||||
pgeo = new mxRectangle(0, 0, width, height);
|
||||
}
|
||||
|
||||
if (pgeo != null)
|
||||
{
|
||||
var children = [];
|
||||
var childCount = model.getChildCount(parent);
|
||||
|
||||
for (var i = 0; i < childCount; i++)
|
||||
{
|
||||
var child = model.getChildAt(parent, i);
|
||||
|
||||
if (!this.isVertexIgnored(child) &&
|
||||
this.isVertexMovable(child))
|
||||
{
|
||||
children.push(child);
|
||||
}
|
||||
}
|
||||
|
||||
var n = children.length;
|
||||
|
||||
if (n > 0)
|
||||
{
|
||||
var x0 = this.border;
|
||||
var y0 = this.border;
|
||||
var other = (horizontal) ? pgeo.height : pgeo.width;
|
||||
other -= 2 * this.border;
|
||||
|
||||
var size = (this.graph.isSwimlane(parent)) ?
|
||||
this.graph.getStartSize(parent) :
|
||||
new mxRectangle();
|
||||
|
||||
other -= (horizontal) ? size.height : size.width;
|
||||
x0 = x0 + size.width;
|
||||
y0 = y0 + size.height;
|
||||
|
||||
var tmp = this.border + (n - 1) * this.spacing;
|
||||
var value = (horizontal) ?
|
||||
((pgeo.width - x0 - tmp) / n) :
|
||||
((pgeo.height - y0 - tmp) / n);
|
||||
|
||||
// Avoids negative values, that is values where the sum of the
|
||||
// spacing plus the border is larger then the available space
|
||||
if (value > 0)
|
||||
{
|
||||
model.beginUpdate();
|
||||
try
|
||||
{
|
||||
for (var i = 0; i < n; i++)
|
||||
{
|
||||
geo = geo.clone();
|
||||
geo.x = x0;
|
||||
geo.y = y0;
|
||||
var child = children[i];
|
||||
var geo = model.getGeometry(child);
|
||||
|
||||
if (horizontal)
|
||||
if (geo != null)
|
||||
{
|
||||
if (this.resizeVertices)
|
||||
geo = geo.clone();
|
||||
geo.x = x0;
|
||||
geo.y = y0;
|
||||
|
||||
if (horizontal)
|
||||
{
|
||||
geo.width = value;
|
||||
geo.height = other;
|
||||
if (this.resizeVertices)
|
||||
{
|
||||
geo.width = value;
|
||||
geo.height = other;
|
||||
}
|
||||
|
||||
x0 += value + this.spacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.resizeVertices)
|
||||
{
|
||||
geo.height = value;
|
||||
geo.width = other;
|
||||
}
|
||||
|
||||
y0 += value + this.spacing;
|
||||
}
|
||||
|
||||
x0 += value + this.spacing;
|
||||
model.setGeometry(child, geo);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.resizeVertices)
|
||||
{
|
||||
geo.height = value;
|
||||
geo.width = other;
|
||||
}
|
||||
|
||||
y0 += value + this.spacing;
|
||||
}
|
||||
|
||||
model.setGeometry(child, geo);
|
||||
}
|
||||
} finally {
|
||||
model.endUpdate();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
model.endUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export default mxPartitionLayout;
|
||||
|
|
Loading…
Reference in New Issue