TWaver Forums
http://twaver.servasoft.com/forum/

shapelink 连线过程中 如何获取各个点的坐标
http://twaver.servasoft.com/forum/viewtopic.php?f=35&t=6188
Page 1 of 1

Author:  yk168168 [ 2019-10-28 9:01 ]
Post subject:  shapelink 连线过程中 如何获取各个点的坐标

network.setCreateShapeLinkInteractions(function(fromNode,toNode) {
var link = new twaver.ShapeLink(fromNode, toNode);
box.add(link);
})

Attachments:
aaaa.png
aaaa.png [ 33.56 KiB | Viewed 1420 times ]

Author:  skm_mks [ 2019-12-16 10:18 ]
Post subject:  Re: shapelink 连线过程中 如何获取各个点的坐标

在连线整体画完之前会拿到这points,不是打点时候获取,想要打点时候获取可以监听一下点击事件
Code:
          network.setInteractions([
            new twaver.vector.interaction.CreateShapeLinkInteraction(
              network,
              function(fromNode, toNode, points) {
                var link = new twaver.ShapeLink();
                link.setFromNode(fromNode);
                link.setToNode(toNode);
                console.log(points)
                if (points) {
                  link.setPoints(points);
                }
                return link;
              }
            ),
            new twaver.vector.interaction.DefaultInteraction(network)
          ]);
        })

Author:  yk168168 [ 2019-12-16 23:54 ]
Post subject:  Re: shapelink 连线过程中 如何获取各个点的坐标

贴子发出好久才有人回复,经过自己摸索已经知道咋搞了,和你的一样,还是很感谢您的回复;官方已经long long long ago不解答问题了

Author:  Paddy [ 2019-12-17 17:21 ]
Post subject:  Re: shapelink 连线过程中 如何获取各个点的坐标

不好意思,我们从来没放弃过呢!感谢您的支持!

Page 1 of 1 All times are UTC + 8 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/