JSPlumb 端点多连接
JSPlumb Endpoint Multiple Connections
我有一些 div
元素,我想通过 JSPlumb Community Edition 连接它们。我在 javascript:
中有这行代码
$("#create_item").click(function() {
var $i = "item" + counter;
var $txt = "Create " + counter;
var $div = $("<div>", {id: $i, class: "box create", text: $txt});
$(".container").append($div);
counter++;
jsPlumb.ready(function() {
jsPlumb.draggable($i, {containment:"parent"});
jsPlumb.addEndpoint($i, {
anchor:"Right" },
sourceEndpointOptions);
});
});
$("#dispose_item").click(function() {
var $i = "item" + counter;
var $txt = "Dispose " + counter;
var $div = $("<div>", {id: $i, class: "box dispose", text: $txt});
$(".container").append($div);
counter++;
jsPlumb.ready(function() {
jsPlumb.draggable($i, {containment:"parent"});
jsPlumb.addEndpoint($i, {
anchor:"Left" },
targetEndpointOptions);
});
});
var sourceEndpointOptions = {
endpoint:"Dot",
paintStyle:{ width:15, height:15, fillStyle:'#666' },
isSource:true,
connectorStyle : { strokeStyle:"#666" },
isTarget:false
};
var targetEndpointOptions = {
endpoint:"Dot",
paintStyle:{ width:15, height:15, fillStyle:'#460CE8' },
isSource:false,
connectorStyle : { strokeStyle:"#460CE8" },
isTarget:true
};
我想做的是在运行时制作两个 #create_tem
和一个 #dispose_item
并将两个源端点连接到目标端点,但是当我将一个源连接到目标时,目标不会接受第二个来源。我该怎么做?
我在终点选项中缺少 maxConnections:-1
!
我有一些 div
元素,我想通过 JSPlumb Community Edition 连接它们。我在 javascript:
$("#create_item").click(function() {
var $i = "item" + counter;
var $txt = "Create " + counter;
var $div = $("<div>", {id: $i, class: "box create", text: $txt});
$(".container").append($div);
counter++;
jsPlumb.ready(function() {
jsPlumb.draggable($i, {containment:"parent"});
jsPlumb.addEndpoint($i, {
anchor:"Right" },
sourceEndpointOptions);
});
});
$("#dispose_item").click(function() {
var $i = "item" + counter;
var $txt = "Dispose " + counter;
var $div = $("<div>", {id: $i, class: "box dispose", text: $txt});
$(".container").append($div);
counter++;
jsPlumb.ready(function() {
jsPlumb.draggable($i, {containment:"parent"});
jsPlumb.addEndpoint($i, {
anchor:"Left" },
targetEndpointOptions);
});
});
var sourceEndpointOptions = {
endpoint:"Dot",
paintStyle:{ width:15, height:15, fillStyle:'#666' },
isSource:true,
connectorStyle : { strokeStyle:"#666" },
isTarget:false
};
var targetEndpointOptions = {
endpoint:"Dot",
paintStyle:{ width:15, height:15, fillStyle:'#460CE8' },
isSource:false,
connectorStyle : { strokeStyle:"#460CE8" },
isTarget:true
};
我想做的是在运行时制作两个 #create_tem
和一个 #dispose_item
并将两个源端点连接到目标端点,但是当我将一个源连接到目标时,目标不会接受第二个来源。我该怎么做?
我在终点选项中缺少 maxConnections:-1
!