Programmatic connection in jsplumb

北慕城南 提交于 2019-12-13 06:42:44

问题


How can I recreate/redraw a connection in jsplumb that has two different image endpoints?

For example:

  instance.connect({source:"source", target:"target", anchors:["Bottom", "Top"], 
endpoint:[ "Image" , {url:"nameofpicture.jpg"} ], connector: "Flowchart"});

this works for one image(the image is the same on the source and target element)

instance.connect({source:"source", target:"target", anchors:["Bottom", "Top"], 
endpoints:["Dot","Rectangle"], connector: "Flowchart"});

this works and connects two elements with different endpoints (not of the same scope)

instance.connect({source:"source", target:"target", anchors:["Bottom", "Top"],
 endpoints:["Image",{url:"nameofpicture1.jpg"},"Image", {url:"nameofpicture2.jpg"}], connector: "Flowchart"});

so the conclusion would be that something like this would work, but it doesn't..

Is there a way to access the source's and target's Image endpoint (parameter) url? Maybe something like this: connectionname.endpoints[0].endpoint.type('url')??


回答1:


Try it like this:

endpoints: [ ['Image', {src:'nameofpicture1.png'}], ['Image', {src:'nameofpicture2.png'}] ]


来源:https://stackoverflow.com/questions/23638137/programmatic-connection-in-jsplumb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!