【问题标题】:Jsplumb change position of static anchorJsplumb改变静态锚点的位置
【发布时间】:2014-03-24 15:06:49
【问题描述】:

我想要完成的是我可以旋转 jsplumb 连接。您可以使用 setAnchor 重新定义 Anchor,但我无法让它工作。我在网上找到了这个,它可以工作,但这不是我想要的。

jsPlumb.selectEndpoints("myclickedelement").setAnchor([ "Continuous", { faces: ["Top", "Bottom", "Left", "Right"] }])

我在对象的顶部和底部有一个端点,当我旋转它时,我希望它们位于左侧和右侧,而不删除现有的连接。

          jsPlumb.addEndpoint($(this).parent("div").attr('id'),     { anchor:[0.5, 0, 0, -1] },
{ isSource:true,
 isTarget:true,
 paintStyle:{ lineWidth:1, strokeStyle:'#ff8700' },
 connector: 'Flowchart',
 hoverPaintStyle:{ strokeStyle:"#ff8700", lineWidth:4},
  })  
jsPlumb.addEndpoint($(this).parent("div").attr('id'),   { anchor:[0.5, 1, 0, 1] },
{ isSource:true,
 isTarget:true,
 paintStyle:{ lineWidth:1, strokeStyle:'#ff8700' },
 connector: 'Flowchart',
 hoverPaintStyle:{ strokeStyle:"#ff8700", lineWidth:4},
  })

这就是我必须用锚创建我的对象

【问题讨论】:

    标签: static anchor endpoint jsplumb


    【解决方案1】:

    我找到了解决办法

    endpoints = jsPlumb.selectEndpoints($(this).attr('id').elementId);
    anchorarray = [[0.5,0,0,-1],[1,0.5,1,0],[0.5,1,0,1],[0,0.5,-1,0]];
    
    endpoints.each(function(ep){
        if (top == 0 && ep.id.contains(clickeditem)) {
                ep.setAnchor(anchorarray[0]);
                top = 1;
    
            } else if (ep.id.contains(clickeditem)) {
                ep.setAnchor(anchorarray[2]);
            }
    }); 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多