diff options
author | jiteshjha | 2016-06-02 17:30:30 +0530 |
---|---|---|
committer | jiteshjha | 2016-06-02 17:30:30 +0530 |
commit | bc42235644fd82510638cc44d83d6cbab95d00ed (patch) | |
tree | f463c6c1cfd38d35c42d16d78b8ecadf32ba570c | |
parent | 792d6be75adcbfa9491e7f4332a45f16a4867b3f (diff) | |
download | xcos-on-web-bc42235644fd82510638cc44d83d6cbab95d00ed.tar.gz xcos-on-web-bc42235644fd82510638cc44d83d6cbab95d00ed.tar.bz2 xcos-on-web-bc42235644fd82510638cc44d83d6cbab95d00ed.zip |
Bug: delete all associated edges
-rw-r--r-- | index.html | 39 |
1 files changed, 36 insertions, 3 deletions
@@ -8,11 +8,11 @@ BODY { font-family: Arial; } - + H1 { font-size: 18px; } - + H2 { font-size: 16px; } @@ -255,10 +255,43 @@ button.appendChild(titleName); }); + editor.addAction('deleteBlock', function(editor, cell) { + var array = []; + var portCount = graph.getSelectionCell().getChildCount(); + array.push(graph.getSelectionCell()); + + for(var i = 0; i < portCount; i++) { + var edgeCount = graph.getSelectionCell().getChildAt(i).getEdgeCount(); + if(edgeCount != 0) { + getEdgeId(graph.getSelectionCell().getChildAt(i)); + + for(var j = 0; j < edgeCount; j++) { + var edgeObject = graph.getSelectionCell().getChildAt(i).getEdgeAt(j); + getEdgeId(edgeObject); + } + } + } + function getEdgeId(eObject) + { + if(eObject != null && eObject.isEdge()) { + for(var j = 0; j < eObject.getEdgeCount(); j++) + { + getEdgeId(eObject.getEdgeAt(j)); + } + if(eObject.edge == true && (array.indexOf(eObject) == -1)) { + array.push(eObject); + } + } + } + + graph.getSelectionModel().setCells(array); + editor.execute('delete'); + }); + addToolbarButton(editor, toolbar, 'toggle', 'Expand All', 'images/navigate_plus.png'); toolbar.appendChild(spacer.cloneNode(true)); - addToolbarButton(editor, toolbar, 'delete', 'Delete', 'images/delete2.png'); + addToolbarButton(editor, toolbar, 'deleteBlock', 'Delete', 'images/delete2.png'); toolbar.appendChild(spacer.cloneNode(true)); addToolbarButton(editor, toolbar, 'cut', 'Cut', 'images/cut.png'); |