@maxgraph/core
Version:
maxGraph is a fully client side JavaScript diagramming library that uses SVG and HTML for rendering.
72 lines (71 loc) • 2.22 kB
TypeScript
import GraphLayout from './GraphLayout.js';
import type { AbstractGraph } from '../AbstractGraph.js';
import type Cell from '../cell/Cell.js';
/**
* Extends {@link GraphLayout} to implement a circular layout for a given radius.
* The vertices do not need to be connected for this layout to work and all
* connections between vertices are not taken into account.
*
* Example:
*
* ```javascript
* const layout = new CircleLayout(graph);
* layout.execute(graph.getDefaultParent());
* ```
*
* @category Layout
*/
declare class CircleLayout extends GraphLayout {
/**
* Constructs a new circular layout for the specified radius.
*
* @param graph {@link AbstractGraph} that contains the cells.
* @param radius Optional radius as an int. Default is 100.
*/
constructor(graph: AbstractGraph, radius?: number);
/**
* Integer specifying the size of the radius. Default is 100.
*/
radius: number;
/**
* Boolean specifying if the circle should be moved to the top,
* left corner specified by <x0> and <y0>. Default is false.
*/
moveCircle: boolean;
/**
* Integer specifying the left coordinate of the circle.
* Default is 0.
*/
x0: number;
/**
* Integer specifying the top coordinate of the circle.
* Default is 0.
*/
y0: number;
/**
* Specifies if all edge points of traversed edges should be removed.
* Default is true.
*/
resetEdges: boolean;
/**
* Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are
* modified by the result. Default is true.
*/
disableEdgeStyle: boolean;
/**
* Implements {@link GraphLayout#execute}.
*/
execute(parent: Cell): void;
/**
* Returns the radius to be used for the given vertex count. Max is the maximum
* width or height of all vertices in the layout.
*/
getRadius(count: number, max: number): number;
/**
* Executes the circular layout for the specified array
* of vertices and the given radius. This is called from
* <execute>.
*/
circle(vertices: Cell[], r: number, left: number, top: number): void;
}
export default CircleLayout;