diff options
-rw-r--r-- | orientation.js | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/orientation.js b/orientation.js index d70da0f..72e885f 100644 --- a/orientation.js +++ b/orientation.js @@ -33,16 +33,17 @@ function transformBlockImage(graph, cell) { } function rotateCustom(editor, graph, cell) { - var selectedCell = graph.getSelectionCell(); - if (selectedCell != null) { - var cells = []; - cells.push(selectedCell); + var selectedCells = graph.getSelectionCells(); + graph.getModel().beginUpdate(); + try { + for ( var count = 0 ; count < selectedCells.length; count++){ + var selectedCell = selectedCells[count]; + if (selectedCell != null) { + var cells = []; + cells.push(selectedCell); - for (var i = 0; i < selectedCell.getChildCount(); i++) - cells.push(selectedCell.getChildAt(i)); - - graph.getModel().beginUpdate(); - try { + for (var i = 0; i < selectedCell.getChildCount(); i++) + cells.push(selectedCell.getChildAt(i)); for (var i = 0; i < cells.length; i++) { var cell = cells[i]; @@ -179,23 +180,25 @@ function rotateCustom(editor, graph, cell) { } } } - } finally { - graph.getModel().endUpdate(); } + } + } + finally { + graph.getModel().endUpdate(); } } function flipCustom(editor, graph, cell) { - var selectedCell = graph.getSelectionCell(); - if (selectedCell != null) { - var cells = []; - cells.push(selectedCell); - - for (var i = 0; i < selectedCell.getChildCount(); i++) - cells.push(selectedCell.getChildAt(i)); - - graph.getModel().beginUpdate(); - try { + var selectedCells = graph.getSelectionCells(); + graph.getModel().beginUpdate(); + try { + for ( var count = 0 ; count < selectedCells.length; count++){ + var selectedCell = selectedCells[count]; + if (selectedCell != null) { + var cells = []; + cells.push(selectedCell); + for (var i = 0; i < selectedCell.getChildCount(); i++) + cells.push(selectedCell.getChildAt(i)); for (var i = 0; i < cells.length; i++) { var cell = cells[i]; if (cell.isVertex() == true) { @@ -336,25 +339,26 @@ function flipCustom(editor, graph, cell) { } } } - } finally { - graph.getModel().endUpdate(); } + } + } finally { + graph.getModel().endUpdate(); } } function mirrorCustom(editor, graph, cell) { - var selectedCell = graph.getSelectionCell(); - - if (selectedCell != null) { - var cells = []; - - cells.push(selectedCell); + var selectedCells = graph.getSelectionCells(); + graph.getModel().beginUpdate(); + try { + for ( var count = 0 ; count < selectedCells.length; count++){ + var selectedCell = selectedCells[count]; + if (selectedCell != null) { + var cells = []; - for (var i = 0; i < selectedCell.getChildCount(); i++) - cells.push(selectedCell.getChildAt(i)); + cells.push(selectedCell); - graph.getModel().beginUpdate(); - try { + for (var i = 0; i < selectedCell.getChildCount(); i++) + cells.push(selectedCell.getChildAt(i)); for (var i = 0; i < cells.length; i++) { var cell = cells[i]; if (cell.isVertex() == true) { @@ -496,8 +500,9 @@ function mirrorCustom(editor, graph, cell) { } } } - } finally { - graph.getModel().endUpdate(); } + } + } finally { + graph.getModel().endUpdate(); } } |