2014-09-12 51 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