【问题标题】:jsPlumb: No connectionDetached event when connectionMoved event firesjsPlumb:connectionMoved事件触发时没有connectionDetached事件
【发布时间】:2015-10-01 13:07:30
【问题描述】:

connectionMoved事件触发时似乎没有connectionDetached事件。

因此,当您移动连接时,它会创建一个新连接并保留旧连接。

我想删除第一个连接。最好在创建第二个之前(不要超过 maxConnections)。这可能吗?

【问题讨论】:

    标签: events connection move jsplumb detach


    【解决方案1】:

    Simon 指出:“移动连接时,jsPlumb 不会创建新连接并删除旧连接。它只是更改其端点的元素。”

    问题就是这样解决的:

        jsPlumbMain.bind("connection", function (info, originalEvent ) {
        if (originalEvent == null) {
            return;
        }
        if (moving) {
            // Remove old connection from DB
            removeItem(info.connection .ourId);
        }
        currentConnection = info.connection;
        var hoverPaintStyle = {strokeStyle: "#CC3333"};
        currentConnection.setHoverPaintStyle(hoverPaintStyle);
        var src = info.sourceEndpoint;
        var dst = info.targetEndpoint;
        createConnection(src.ourId, dst.ourId);
    
        moving = false;
    });
    
    jsPlumbMain.bind("connectionDetached", function (info) {
        var conn = info.connection;
        removeItem(conn.ourId);
        moving = false;
    });
    
    jsPlumbMain.bind("connectionMoved", function (info, originalEvent) {
        alert('moved');
        moving = true;
    });
    

    【讨论】:

      猜你喜欢
      • 2013-02-12
      • 2019-09-16
      • 1970-01-01
      • 1970-01-01
      • 2017-03-12
      • 1970-01-01
      • 2017-04-27
      • 1970-01-01
      • 2013-01-22
      相关资源
      最近更新 更多