Skip to content

@jtopo/core / LayoutSystem

Class: LayoutSystem<T> ​

布局系统

Type parameters ​

NameType
Textends LayoutNode

Table of contents ​

Constructors ​

Methods ​

Constructors ​

constructor ​

new LayoutSystem<T>(animationSystem, graphSystem)

Type parameters ​

NameType
Textends LayoutNode

Parameters ​

NameType
animationSystemAnimationSystem
graphSystemGraphSystem

Methods ​

pointsLayout ​

pointsLayout(objects, pointArr): Layout<T>

根据指定的点坐标集合生成布局

对象的个数 <= 点的个数

Parameters ​

NameType
objectsT[]
pointArrPointLike[]

Returns ​

Layout<T>


sizeFitToChildren ​

sizeFitToChildren(node, padding?): void

调整节点对象的尺寸:尺寸刚好覆盖住所有子节点

Parameters ​

NameType
nodeany
padding?number

Returns ​

void


starLayout ​

starLayout(graph): Layout<any>

对指定图对象做星形布局

指定的图如果不是一棵树,将自动生成图的最小生成树,然后根据最小生成树生成布局对象

Parameters ​

NameType
graphGraph

Returns ​

Layout<any>


travelTree ​

travelTree(graph, rootVetext): any[]

遍历一棵树所有顶点-广度优先

Parameters ​

NameType
graphGraph
rootVetextVertext

Returns ​

any[]


treeLayout ​

treeLayout(graph): Layout<any>

对指定图对象做树形布局

指定的图如果不是一棵树,将自动生成图的最小生成树,然后根据最小生成树生成布局对象

Parameters ​

NameType
graphGraph

Returns ​

Layout<any>