Appearance
@jtopo/core / RegShape
Class: RegShape
通过Assets.regShape 注册的图形
Hierarchy
↳
RegShape
Table of contents
Constructors
Properties
Methods
- draw
- getAnchors
- getConnectAutoPoint
- getConnectionAnchor
- getConnectionAnchors
- getIntersect
- hasAnchor
- setConnections
- toJSON
- circle
- fromJSON
- grid
- innerGrid
- polygon
Constructors
constructor
new RegShape()
Inherited from
Properties
className
className: any
类名称
Overrides
height
height: number
默认或建议的高度,默认32
Inherited from
isClosed
isClosed: boolean
= true
是否封闭图形(最后一个点是否连接到第一个点形成封闭图形),默认true
Inherited from
isUnit
isUnit: boolean
Inherited from
vertices
Readonly
vertices: PointLike
[] = []
顶点集合(归一化坐标)
Inherited from
width
width: number
默认或建议的宽度,默认32
Inherited from
Methods
draw
draw(ctx
, node
): void
绘制图形
Parameters
Name | Type |
---|---|
ctx | CanvasRenderingContext2D |
node | NE |
Returns
void
Overrides
getAnchors
getAnchors(): Map
<string
, Anchor
>
Returns
Map
<string
, Anchor
>
Inherited from
getConnectAutoPoint
getConnectAutoPoint(x
, y
, obj
): Object
获取连接点 (x,y) -> 本对象中心 与边框的交点
Parameters
Name | Type |
---|---|
x | number |
y | number |
obj | NE |
Returns
Object
Name | Type |
---|---|
x | number |
y | number |
Inherited from
getConnectionAnchor
getConnectionAnchor(name
): Anchor
获取连接点
Parameters
Name | Type |
---|---|
name | string |
Returns
Inherited from
getConnectionAnchors
getConnectionAnchors(): IterableIterator
<Anchor
>
获取所有连接点
Returns
IterableIterator
<Anchor
>
Inherited from
getIntersect
getIntersect(x
, y
, obj
): Intersect
获取 图形上距离(x,y)最近的点
Parameters
Name | Type |
---|---|
x | number |
y | number |
obj | NE |
Returns
Intersect
Inherited from
hasAnchor
hasAnchor(name
): boolean
Parameters
Name | Type |
---|---|
name | string |
Returns
boolean
Inherited from
setConnections
setConnections(connections
): void
设置连接点
Parameters
Name | Type |
---|---|
connections | { name : string ; x : number ; y : number ; usage? : AnchorUsageType }[] |
Returns
void
Inherited from
toJSON
toJSON(): any
Returns
any
Inherited from
circle
Static
circle(opt
): any
[]
生成圆环点坐标
Parameters
Name | Type |
---|---|
opt | BuildCircleOpt |
Returns
any
[]
PointLike[] 顶点坐标集合
Inherited from
fromJSON
Static
fromJSON(json
): Shape
Parameters
Name | Type |
---|---|
json | any |
Returns
Inherited from
grid
Static
grid(rows
, cols
): PointLike
[]
生成二维网格坐标数组
Parameters
Name | Type | Description |
---|---|---|
rows | number | 行 |
cols | number | 列 |
Returns
PointLike[] 顶点坐标集合
Inherited from
innerGrid
Static
innerGrid(rows
, cols
): PointLike
[]
生成二维内网格坐标数组(有内边距)
Parameters
Name | Type | Description |
---|---|---|
rows | number | 行 |
cols | number | 列 |
Returns
PointLike[] 顶点坐标集合
Inherited from
polygon
Static
polygon(edgeCount
): any
[]
生成 正多边形 (最小为3边形,小于3边形时,按3边形处理)
Parameters
Name | Type | Description |
---|---|---|
edgeCount | number | 边数 |
Returns
any
[]
PointLike[] 顶点坐标集合