Provides various perimeter functions to be used in a style as the value of mxConstants.STYLE_PERIMETER. Perimeters for rectangle, circle, rhombus and triangle are available.
<add as="perimeter">mxPerimeter.RectanglePerimeter</add>
style[mxConstants.STYLE_PERIMETER] = mxPerimeter.RectanglePerimeter;
When adding new perimeter functions, it is recommended to use the mxPerimeter-namespace as follows:
mxPerimeter.CustomPerimeter = function (bounds, vertex, next, orthogonal) { var x = 0; // Calculate x-coordinate var y = 0; // Calculate y-coordainte return new mxPoint(x, y); }
mxStyleRegistry.putValue('customPerimeter', mxPerimeter.CustomPerimeter);
model.setStyle(vertex, 'perimeter=customPerimeter');
Note that the key of the mxStyleRegistry entry for the function should be used in string values, unless mxGraphView.allowEval is true, in which case you can also use mxPerimeter.CustomPerimeter for the value in the cell style above.
var style = graph.getStylesheet().getDefaultVertexStyle(); style[mxConstants.STYLE_PERIMETER] = mxPerimeter.CustomPerimeter;
Note that the object can be used directly when programmatically setting the value, but the key in the mxStyleRegistry should be used when setting the value via a key, value pair in a cell style.
The parameters are explained in RectanglePerimeter.
mxPerimeter | Provides various perimeter functions to be used in a style as the value of mxConstants.STYLE_PERIMETER. |
Functions | |
RectanglePerimeter | Describes a rectangular perimeter for the given bounds. |
EllipsePerimeter | Describes an elliptic perimeter. |
RhombusPerimeter | Describes a rhombus (aka diamond) perimeter. |
TrianglePerimeter | Describes a triangle perimeter. |
HexagonPerimeter | Describes a hexagon perimeter. |
RectanglePerimeter: function ( bounds, vertex, next, orthogonal )
Describes a rectangular perimeter for the given bounds.
bounds | mxRectangle that represents the absolute bounds of the vertex. |
vertex | mxCellState that represents the vertex. |
next | mxPoint that represents the nearest neighbour point on the given edge. |
orthogonal | Boolean that specifies if the orthogonal projection onto the perimeter should be returned. If this is false then the intersection of the perimeter and the line between the next and the center point is returned. |
EllipsePerimeter: function ( bounds, vertex, next, orthogonal )
Describes an elliptic perimeter. See RectanglePerimeter for a description of the parameters.
RhombusPerimeter: function ( bounds, vertex, next, orthogonal )
Describes a rhombus (aka diamond) perimeter. See RectanglePerimeter for a description of the parameters.
TrianglePerimeter: function ( bounds, vertex, next, orthogonal )
Describes a triangle perimeter. See RectanglePerimeter for a description of the parameters.
HexagonPerimeter: function ( bounds, vertex, next, orthogonal )
Describes a hexagon perimeter. See RectanglePerimeter for a description of the parameters.
Defines the key for the perimeter style.
STYLE_PERIMETER: 'perimeter'
Describes a rectangular perimeter for the given bounds.
RectanglePerimeter: function ( bounds, vertex, next, orthogonal )
Describes an elliptic perimeter.
EllipsePerimeter: function ( bounds, vertex, next, orthogonal )
Describes a rhombus (aka diamond) perimeter.
RhombusPerimeter: function ( bounds, vertex, next, orthogonal )
Describes a triangle perimeter.
TrianglePerimeter: function ( bounds, vertex, next, orthogonal )
Describes a hexagon perimeter.
HexagonPerimeter: function ( bounds, vertex, next, orthogonal )
Specifies if string values in cell styles should be evaluated using mxUtils.eval.
mxGraphView.prototype.allowEval