1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| // 是否具有该线
| export function hasLine(data, from, to) {
| for (let i = 0; i < data.lineList.length; i++) {
| let line = data.lineList[i]
| if (line.from === from && line.to === to) {
| return true
| }
| }
| return false
| }
|
| // 是否含有相反的线
| export function hashOppositeLine(data, from, to) {
| return hasLine(data, to, from)
| }
|
| // 获取连线
| export function getConnector(jsp, from, to) {
| let connection = jsp.getConnections({
| source: from,
| target: to
| })[0]
| return connection
| }
|
| // 获取唯一标识
| export function uuid() {
| return Math.random().toString(36).substr(3, 10)
| }
|
|