Skip to content

Class: Endpoint

端点基类,表示link连接对象上的具体位置

子类有:

EndpointFixedPoint: 表示连接到一个固定的坐标(x,y)

EndpointSegment: 表示连接到Node或Link的某一条线段上

EndpointFixedName: 表示连接到Node或Link的某个 ’位置‘ 上,如: 'center'、'ct'、'lm'

EndpointNearest: 表示连接到Node的边框上

js

import {EndpointFixedPoint} from '@jtopo/core';

// 示例
link.setBegin({x: 10, y: 10});

// 等价于:
let endpoint = new EndpointFixedPoint(10, 10);
link.setBegin(endpoint); 

let endpointBegin = link.begin;
console.log(endpointBegin.x); // => 10

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Endpoint()

Properties

className

className: string


target

Optional target: DisplayObject

被连接的对象, 可能为空

Methods

hasTarget

hasTarget(): boolean

Returns

boolean


isDisplayObjectTarget

isDisplayObjectTarget(): boolean

Returns

boolean


isNodeTarget

isNodeTarget(): any

Returns

any


toJSON

toJSON(objIndexMap?): any

Parameters

NameType
objIndexMap?Map<DisplayObject, number>

Returns

any


fromJSON

Static fromJSON(json, objIndexMap?): any

Parameters

NameType
jsonany
objIndexMap?Object

Returns

any