2014-09-12 50 views
1

我有一个动态生成的流程图与jsPlumb。 我将它保存到MySQL数据库,我需要一个不带任何编辑功能的不同视图。jsPlumb端点可见:false?

我知道如何删除所有部分,使他们不能编辑 但它总是显示连接点(左,右,上,下)

我怎样才能让他们看不见的,这样我只看到连接器/没有我的连接点的箭头?

sourceEndpoint = { 
    endpoint:["Rectangle",{ width:1, height:1}], 
    paintStyle:{ 
     fillStyle:"#db0013", 
    }, 
    maxConnections:999,  
    isSource:false, 
    isTarget:false,   
    connector:[ "Flowchart", { stub:[10, 25], gap:0, cornerRadius:0, alwaysRespectStubs:false } ],            
    connectorStyle:connectorPaintStyle, 
    hoverPaintStyle:endpointHoverStyle, 
    connectorHoverStyle:connectorHoverStyle, 
    dragOptions:{}  
    }, 

矩形宽度和高度= 1使得它非常小,但仍可见 我怎样才能使它invis? :)

THX所以发

XQP

回答

1

有两个更多的方法:

  1. 使用空白端点类型。 It does not draw anything visible to the user.

  2. 添加的CssClass到sourceEndpoint选项

    sourceEndpoint = { 
    ... other options ... 
        cssClass: 'source-endpoint' 
    } 
    

    和CSS样式

    .source-endpoint svg * { 
        fill: transparent; 
        stroke: transparent; 
    } 
    
+0

THX再试一次对于那个解决方案,稍晚一点,但仍然可以使用它thx – xQp 2015-03-24 12:09:54

0

http://www.jsplumb.org/doc/endpoints.html我注意到你可以添加CSS到端点。你不能只使用CSS“display:none”吗?

+0

tryed,但没有工作也许生病在PHP,而不是直接的外部CSS – xQp 2014-09-12 12:13:40

1

由于没有函数来获取所有的端点,因此你需要得到有终点,然后针对个别元素的每个端点,你需要设置它的可见假所有元素:

var elem = $('.havingEndpoint'); // get elements having endpoint based on its class 

for(var i=0;i<elem.length;i++) // for all elements having endpoints iterate 
{ 
    var eps=jsPlumb.getEndpoints($(elem[i])); //get all endpoints of element 
    for(var j=0;j<eps.length;j++) 
    { 
      eps[j].setVisible(false); // Set visibility of endpoint to false 
    } 
} 

更多参考API文档的查看:

- >Getting endpoints for an element

- >Setting visibility for endpoint