【发布时间】:2017-05-30 07:00:42
【问题描述】:
我正在尝试绘制流程图。我动态创建 div,并为每个 div 设置了一个唯一的“id”属性,并使用 Jsplumb 连接器连接它们。
我从数据库中获取源和目标 id(请注意,动态创建的 div 的 '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 连接器重叠。
我需要的是像下面这样分开两个连接
我在任何地方都找不到解决方案。有什么帮助吗?谢谢!
【问题讨论】:
标签: jsplumb