jsPlumb编辑端点的位置

时间:2014-09-12 10:27:15

标签: location endpoint jsplumb

使用jsPlumb处理项目我将静态连接器设置为两个地图标记。 jsplumb连接器的端点出现在地图标记图像上方,而我希望它们显示在下方。

从哪里开始,在jsplumb javascript库中,我是否可以编辑端点的计算位置?

1 个答案:

答案 0 :(得分:4)

设置端点锚点位置的一种方法是使用jsPlumb默认值:

jsPlumb.importDefaults({
    PaintStyle : {lineWidth:1,strokeStyle:color2},
    Connector: ["Straight"],
    Anchor:"Continuous" // dymamically nearest position will be considered for endpoint
    //OR
    Anchor:["Top","Bottom"] // only top or bottom center whichever is near will be considered as endpoints
    //OR
    Anchor:["Left","Right"] // similarly left or right center will be considered
});

也可以在连接时声明:

jsPlumb.connect({
     source:someDiv,
     target:someOtherDiv,
     anchors:["Bottom", "Continuous"] // Bottom nearest point will be considered
});

对于makeTarget和makeSource,将其声明为:

jsPlumb.makeSource(someDiv, {
     anchor:"Continuous",
     paintStyle:{ fillStyle:"red" }
});

或者在将端点声明添加为:

jsPlumb.addEndpoint(someDiv, {
     anchor:"Continuous",
     paintStyle:{ fillStyle:"red" }
 });