2017-11-17 41 views
0

私はドキュメントに必要なものを見つけるのに苦労しています。私は定数があることを知っていますが、私が望むことをするものを見つけることはできないようです。mxgraph接続とラベルハンドルを削除しますか?

頂点へのエッジ接続ハンドルを接続解除できないようにmxGraphを作成します。私はそれらを見せたくありません。さらに、ラベルのハンドル、私は削除したいと思います。

どうすればよいですか?

function main(container) { 

    // Enables rotation handle 
    mxVertexHandler.prototype.rotationEnabled = false; 
    mxVertexHandler.prototype.guidesEnabled = false; 

    // Alt disables guides 
    mxGuide.prototype.isEnabledForEvent = function(evt) { 
     return !mxEvent.isAltDown(evt); 
    }; 


    // Enables snapping waypoints to terminals 
    mxEdgeHandler.prototype.snapToTerminals = true; 


    // Checks if the browser is supported 
    if (!mxClient.isBrowserSupported()) { 
     console.log('flip to the browser compatiability message'); 
    } 

    // Disables built-in context menu 
    mxEvent.disableContextMenu(document.body); 

    // Changes some default colors 
    mxConstants.HANDLE_FILLCOLOR = '#99ccff'; 
    mxConstants.HANDLE_STROKECOLOR = '#0088cf'; 
    mxConstants.VERTEX_SELECTION_COLOR = '#00a8ff'; 

    // Creates the graph inside the given container 
    var graph = new mxGraph(container); 
    var parent = graph.getDefaultParent(); 



    var baseStyle = graph.getStylesheet().getDefaultVertexStyle(); 
    var edgeStyle = graph.getStylesheet().getDefaultEdgeStyle(); 

    // setup style 
    style = mxUtils.clone(baseStyle); 
    style[mxConstants.STYLE_EDITABLE] = 0; 
    style[mxConstants.STYLE_FILLCOLOR] = "#ffffff"; 
    style[mxConstants.STYLE_STROKECOLOR] = "#d4d4d4"; 
    style[mxConstants.STYLE_STROKEWIDTH] = 1; 
    style[mxConstants.STYLE_ROUNDED] = 1; 
    style[mxConstants.STYLE_ARCSIZE] = 10; 
    style[mxConstants.STYLE_RESIZABLE] = 0; 
    style[mxConstants.STYLE_MARGIN] = 50; 
    graph.getStylesheet().putCellStyle("style", style) 

    edgeStyle[mxConstants.STYLE_EDITABLE] = 0; 
    edgeStyle[mxConstants.STYLE_RESIZABLE] = 0; 
    edgeStyle[mxConstants.STYLE_STROKECOLOR] = "#d4d4d4"; 
    edgeStyle[mxConstants.STYLE_ORTHOGONAL] = 0; 
    edgeStyle[mxConstants.STYLE_STROKEWIDTH] = 1; 
    edgeStyle[mxConstants.STYLE_BENDABLE] = 1; 
    edgeStyle[mxConstants.STYLE_ROUNDED] = true; 
    edgeStyle[mxConstants.STYLE_EDGE] = mxConstants.EDGESTYLE_ENTITY_RELATION; 
    edgeStyle[mxConstants.LABEL_HANDLE_SIZE] = 50; 
    edgeStyle[mxConstants.HANDLE_FILLCOLOR] = '#000000' 
    graph.getStylesheet().putCellStyle("edge_style", edgeStyle); 

    try { 
     var v1 = graph.insertVertex(parent, null, 'One', 20, 20, 80, 30, 'style'); 
     var v2 = graph.insertVertex(parent, null, 'Two', 200, 150, 80, 30, 'style'); 
     var v3 = graph.insertVertex(parent, null, 'Three', 460, 20, 80, 30, 'style'); 

     var e1 = graph.insertEdge(parent, null, 'connected', v1, v2, "edge_style"); 
     var e2 = graph.insertEdge(parent, null, 'connected', v1, v3, "edge_style"); 
     var e4 = graph.insertEdge(parent, null, 'connected', v3, v2, "edge_style"); 

     // TODO: make it so only the root cell can't be moved 
     graph.isCellLocked = function(cell) { 
      return false; 
     } 

     // can't resize cells 
    } finally { 
     graph.getModel().endUpdate(); 
    } 
} 

答えて

0

この関数は、エッジが自由に動かないようにVerticesに固定するように制限します。

graph.setAllowDanglingEdges(false); 

これを試してみてください。

関連する問題