gpt4 book ai didi

javascript - 如何从单个起点连接多个端点?

转载 作者:行者123 更新时间:2023-12-01 05:25:28 25 4
gpt4 key购买 nike

下面的代码使我能够将一个起点连接到端点 A 或端点 B,但不能同时连接到两者!有人可以帮我修改这个以便可以链接到两个端点吗?
Here's a fiddle to illustrate my point ))

$(function() {

jsPlumb.ready(function() {
var jsp = jsPlumb.getInstance();
jsp.draggable($("#start"));
jsp.draggable($("#end_A"));
jsp.draggable($("#end_B"));

var endpoint = jsp.addEndpoint($("#start"), {
isSource:true
});

jsp.addEndpoint($("#end_A"), {
isTarget:true
});

var endpoint = jsp.addEndpoint($("#start"), {
isSource:true
});

jsp.addEndpoint($("#end_B"), {
isTarget:true
});

$("#dragbutton").bind("mousedown", function(e) {

$(document).bind("mousemove.adjust", function(e) {

var left = e.offsetX;
var top = e.offsetY;
$(endpoint.canvas).css({"left":left, "top":top});
$(document).unbind("mousemove.adjust");
});

$(endpoint.canvas).trigger(e)
})

})

})

最佳答案

使用ma​​xConnections属性。

maxConnections: -1 // unlimited connections
maxConnections: 1 // only one connection

关于javascript - 如何从单个起点连接多个端点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40023620/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com