【问题标题】:jsplumb: Creating two connections from the same source anchorjsplumb:从同一个源锚创建两个连接
【发布时间】:2013-02-03 00:41:20
【问题描述】:

jsPlumb 试图从同一个源锚点创建两个连接,这让我感到非常难过。

例如,在下面的 JSFiddle 中,我尝试创建从块 1 锚点到其他两个块 2 和 3 的两个连接。 http://jsfiddle.net/dutchman71/TYerW/3/

由于某种原因,它在此处的 jsPlumb 示例中使用绿点锚点运行良好。 http://jsplumb.org/jquery/draggableConnectorsDemo.html#

谁能告诉我我错过了什么?

            var endpointOptions = { 
                    anchor:"BottomCenter",
                    maxConnections:-1, 
                    isSource:true, 
                    isTarget:true, 
                    endpoint:["Dot", {radius:6}], 
                    setDragAllowedWhenFull:true,
                    paintStyle:{fillStyle:"#5b9ada"},
                    connectorStyle : {  lineWidth: 4, strokeStyle:"#5b9ada" },
                    connector:[ "Bezier", { curviness:1 }],
                    connectorOverlays:[ 
                        [ "Arrow", { width:15, length:15, location:1, id:"arrow" } ], 
                        [ "Label", { label:"", id:"label" } ]
                    ]               
                    }

            jsPlumb.bind("ready", function() {

                    jsPlumb.addEndpoint('block1', endpointOptions);

                    jsPlumb.addEndpoint('block2', endpointOptions);

                    jsPlumb.addEndpoint('block3', endpointOptions);

                    jsPlumb.draggable('block1');
                    jsPlumb.draggable('block2');
                    jsPlumb.draggable('block3');
            });

【问题讨论】:

    标签: jsplumb


    【解决方案1】:

    Google 小组的一位好人帮我解决了这个问题:我从另一个示例中包含的 jsPlumb 版本已过时。如果我包含这个http://jsplumb.org/js/jquery.jsPlumb-1.3.16-all-min.js 就可以了。

    【讨论】:

    • 谢谢你给出这个问题的答案,让我也卡住了。
    【解决方案2】:

    将 maxconnections 设置为正整数。应该这样做。

    也许你应该让你的端点更大,并给连接线一个比端点更小的 z-index,这样你就不会在画布而不是 div 上点击错误 (在与 Block 2 建立连接后,画布几乎阻塞了 Block 1 上的整个 div,在您的元素检查器/firebug/etc 中检查它)

    【讨论】:

      【解决方案3】:

      将endPoint的半径改为endpoint

      [“点”,{半径:1}],

      和connectorStyle的线宽为1

      connectorStyle : { lineWidth: 4, strokeStyle:"#5b9ada" }

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-10-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-11-02
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多