Skip to content

Class: EndpointNearest

端点:以两个对象之间最短距离来定位

js
import {EndpointNearest} from '@jtopo/core';

// 示例
let endpoint = new EndpointNearest(node);
link.setBegin(endpoint); 

等价于:
link.setBegin(node, 'nearest');

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new EndpointNearest(target)

Parameters

NameType
targetDisplayObject

Overrides

Endpoint.constructor

Properties

className

className: string

Overrides

Endpoint.className


target

target: DisplayObject

被连接的对象

Overrides

Endpoint.target

Methods

getAngle

getAngle(p): number

Parameters

NameTypeDescription
pPointLike边框上的交点

Returns

number


hasTarget

hasTarget(): boolean

Returns

boolean

Inherited from

Endpoint.hasTarget


isDisplayObjectTarget

isDisplayObjectTarget(): boolean

Returns

boolean

Inherited from

Endpoint.isDisplayObjectTarget


isNodeTarget

isNodeTarget(): any

Returns

any

Inherited from

Endpoint.isNodeTarget


toJSON

toJSON(objIndexMap?): any

Parameters

NameType
objIndexMap?Map<DisplayObject, number>

Returns

any

Inherited from

Endpoint.toJSON


fromJSON

Static fromJSON(json, objIndexMap?): any

Parameters

NameType
jsonany
objIndexMap?Object

Returns

any

Inherited from

Endpoint.fromJSON