Options
All
  • Public
  • Public/Protected
  • All
Menu
example
<add as="perimeter">mxPerimeter.RectanglePerimeter</add>

Or programmatically

example
style[mxConstants.STYLE_PERIMETER] = mxPerimeter.RectanglePerimeter;

When adding new perimeter functions, it is recommended to use the mxPerimeter-namespace as follows:

example
mxPerimeter.CustomPerimeter = function (bounds, vertex, next, orthogonal)
{
  var x = 0; // Calculate x-coordinate
  var y = 0; // Calculate y-coordainte

  return new mxPoint(x, y);
}

The new perimeter should then be registered in the mxStyleRegistry as follows

example
mxStyleRegistry.putValue('customPerimeter', mxPerimeter.CustomPerimeter);

The custom perimeter above can now be used in a specific vertex as follows:

example
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.

Or it can be used for all vertices in the graph as follows:

example
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.

Hierarchy

  • mxPerimeter

Index

Constructors

constructor

Methods

Static EllipsePerimeter

Static HexagonPerimeter

Static RectanglePerimeter

  • Describes a rectangular perimeter for the given bounds.

    Parameters

    • bounds: mxRectangle

      mxRectangle that represents the absolute bounds of the vertex.

    • vertex: mxCellState

      mxCellState that represents the vertex.

    • next: mxPoint

      mxPoint that represents the nearest neighbour point on the given edge.

    • Optional orthogonal: boolean

      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.

    Returns mxPoint

Static RhombusPerimeter

Static TrianglePerimeter

Generated using TypeDoc