trassel
Version:
Graph computing in JavaScript
21 lines (20 loc) • 1.04 kB
TypeScript
/**
* Creates an tree component that sorts nodes on an axis (either y or x) based on the Reingold-Tilford algorithm
* The algorithm has been modified slightly to allow for things like multiple root nodes, centering in a coordinate system, and varying node sizes.
* @param {boolean=} isVerticalLayout - If true the tree will be top to bottom, otherwise it will be left to right
* @param {number=} padding - Minimum padding between nodes described in pixels
* @param {number=} centerX - Center X coordinate of the component
* @param {number=} centerY - Center Y coordinate of the component
*/
export default class Tree extends LayoutComponent {
constructor(isVerticalLayout?: boolean, padding?: number, centerX?: null, centerY?: null);
isVerticalLayout: boolean;
PADDING_PX: number;
centerX: number | null;
centerY: number | null;
nodePositions: Map<any, any>;
getWidth(node: any): any;
getHeight(node: any): any;
initialize(...args: any[]): void;
}
import LayoutComponent from "./layoutcomponent";