View unanswered posts | View active topics It is currently 2019-10-19 1:26



Reply to topic  [ 3 posts ] 
 setLinkPathFunction这个方法可以识别两个节点之间有几条连线吗 
Author Message
新手上路

Joined: 2019-04-08 11:31
Posts: 10
Post setLinkPathFunction这个方法可以识别两个节点之间有几条连线吗
如题,我采用了setLinkPathFunction的方式将画布上所有link连线弄成了曲线,
但是我现在遇到一个问题就是两个节点之间可能有多条连线,因为setLinkPathFunction是采用前后两点坐标计算弧度的,这样导致的结果就是多条连线转化成曲线后重合成了一条。
有什么办法可以让我在setLinkPathFunction方法中知道两点已有的连线数量?


2019-04-08 11:38
Profile
新手上路

Joined: 2019-03-04 14:41
Posts: 15
Post Re: setLinkPathFunction这个方法可以识别两个节点之间有几条连线吗
setLinkPathFunction 传入的函数参数有 linkUI , 通过 linkUI.getElment(), 拿到该link 对象,通过link.getFromNode 和 link.getToNode 拿到起始节点,直接遍历databox, 找到数据盒子中所有以上面节点为起始节点创建出来的link。
var arr = [];
box.getDatas().forEach(function(ele){
if(ele instanceof twaver.Link){
if(ele.getFromNode() === fn && ele.getToNode === tn){
arr.push(ele);
}
}
})


2019-04-08 15:21
Profile
新手上路

Joined: 2019-04-08 11:31
Posts: 10
Post Re: setLinkPathFunction这个方法可以识别两个节点之间有几条连线吗
多谢!


2019-04-09 9:45
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron