summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPooja Soundalgekar2016-07-12 17:10:53 +0530
committerPooja Soundalgekar2016-07-12 17:10:53 +0530
commit478f4d2ac25195ddd948d713fd975e973ebd7c3a (patch)
treee2ebbbffe42bbad7cad3dfa8c8f2649def53ca88
parent237595a09c62195ba7f2ac11460fbe277ed1874b (diff)
downloadxcos-on-web-478f4d2ac25195ddd948d713fd975e973ebd7c3a.tar.gz
xcos-on-web-478f4d2ac25195ddd948d713fd975e973ebd7c3a.tar.bz2
xcos-on-web-478f4d2ac25195ddd948d713fd975e973ebd7c3a.zip
for all blocks orientation
-rw-r--r--orientation.js75
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();
}
}