我试图画一个流程图。我动态创建div,并为每个div设置了唯一的“id”属性,并使用Jsplumb连接器连接它们。Jsplumb - 连接器
我从数据库中获取源和目标ID(注意动态创建的'id'属性是数据库的ID)并存储在'connectors'json中。其格式是 例如:
{[从:A,于:B],[自:A,到:C],[自:B,到:C]}
angular.forEach(connectors, function (connect) {
$scope.connection(connect.from, connect.to);
})
的jsplumb代码如下
$scope.connection = function (s, t) {
var stateMachineConnector1 = {
connector: ["Flowchart", { stub: 25, midpoint: 0.001 }],
maxConnections: -1,
paintStyle: { lineWidth: 3, stroke: "#421111" },
endpoint: "Blank",
anchor: "Continuous",
anchors: [strt, end],
overlays: [["PlainArrow", { location: 1, width: 15, length: 12 }]]
};
var firstInstance = jsPlumb.getInstance();
firstInstance.connect({ source: s.toString(), target: t.toString() }, stateMachineConnector1);
}
问题:
我现在已经是
此处连接器B到C与现有的A到C连接器重叠。
我需要的是两个连接分离像下面
我找不到这个随时随地的解决方案。任何帮助?谢谢!
这并不提供答案的问题。一旦你有足够的[声誉](https://stackoverflow.com/help/whats-reputation),你将可以[对任何帖子发表评论](https://stackoverflow.com/help/privileges/comment);相反,[提供不需要提问者澄清的答案](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can- I-DO-代替)。 - [来自评论](/ review/low-quality-posts/17401098) –
@MCEmperor是的,我更新了更准确的解决方案。(也许) –
这样更好! –