summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPooja Soundalgekar2016-07-12 23:37:21 +0530
committerPooja Soundalgekar2016-07-12 23:37:21 +0530
commit69ab3cbceb9c9efa281e3ec6e17cc884ea6c10ad (patch)
tree2ab411347eb2f4b70e224e591d88a17857f21268
parent478f4d2ac25195ddd948d713fd975e973ebd7c3a (diff)
downloadxcos-on-web-69ab3cbceb9c9efa281e3ec6e17cc884ea6c10ad.tar.gz
xcos-on-web-69ab3cbceb9c9efa281e3ec6e17cc884ea6c10ad.tar.bz2
xcos-on-web-69ab3cbceb9c9efa281e3ec6e17cc884ea6c10ad.zip
colour for all blocks
-rwxr-xr-xindex.html48
1 files changed, 29 insertions, 19 deletions
diff --git a/index.html b/index.html
index a4f3632..b22e435 100755
--- a/index.html
+++ b/index.html
@@ -2466,28 +2466,38 @@
btn.style.cssText = 'margin-left: 75px';
// Executes when button 'btn' is clicked
btn.onclick = function() {
- var input = document.getElementById('color').value;
- var style = graph.getModel().getStyle(cell);
+ var selectedCells = graph.getSelectionCells();
+ graph.getModel().beginUpdate();
+ try {
+ for ( var count = 0 ; count < selectedCells.length; count++){
+ var selectedCell = selectedCells[count];
+ var input = document.getElementById('color').value;
+ var style = graph.getModel().getStyle(selectedCell);
- if (style != null) {
- var styleObject = styleToObject(style);
- }
+ if (style != null) {
+ var styleObject = styleToObject(style);
+ }
- if (selectProperty == "edgeStrokeColor") {
- styleObject['strokeColor'] = input;
- } else if (selectProperty == "bgColor") {
- graph.container.style.backgroundColor = input;
- } else if (selectProperty == "vertexStrokeColor") {
- styleObject['strokeColor'] = input;
- } else if (selectProperty == "vertexFillColor") {
- styleObject['fillColor'] = input;
- } else if (selectProperty == "edgeTextColor") {
- styleObject['fontColor'] = input;
- }
+ if (selectProperty == "edgeStrokeColor") {
+ styleObject['strokeColor'] = input;
+ } else if (selectProperty == "bgColor") {
+ graph.container.style.backgroundColor = input;
+ } else if (selectProperty == "vertexStrokeColor") {
+ styleObject['strokeColor'] = input;
+ } else if (selectProperty == "vertexFillColor") {
+ styleObject['fillColor'] = input;
+ } else if (selectProperty == "edgeTextColor") {
+ styleObject['fontColor'] = input;
+ }
- if (style != null) {
- style = objectToStyle(styleObject);
- graph.getModel().setStyle(cell, style);
+ if (style != null) {
+ style = objectToStyle(styleObject);
+ graph.getModel().setStyle(selectedCell, style);
+ }
+ }
+ }
+ finally {
+ graph.getModel().endUpdate();
}
wind.destroy();