From 478f4d2ac25195ddd948d713fd975e973ebd7c3a Mon Sep 17 00:00:00 2001 From: Pooja Soundalgekar Date: Tue, 12 Jul 2016 17:10:53 +0530 Subject: for all blocks orientation --- orientation.js | 75 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 35 deletions(-) (limited to 'orientation.js') 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(); } } -- cgit