diff options
author | Pooja Soundalgekar | 2016-07-12 23:37:21 +0530 |
---|---|---|
committer | Pooja Soundalgekar | 2016-07-12 23:37:21 +0530 |
commit | 69ab3cbceb9c9efa281e3ec6e17cc884ea6c10ad (patch) | |
tree | 2ab411347eb2f4b70e224e591d88a17857f21268 | |
parent | 478f4d2ac25195ddd948d713fd975e973ebd7c3a (diff) | |
download | xcos-on-web-69ab3cbceb9c9efa281e3ec6e17cc884ea6c10ad.tar.gz xcos-on-web-69ab3cbceb9c9efa281e3ec6e17cc884ea6c10ad.tar.bz2 xcos-on-web-69ab3cbceb9c9efa281e3ec6e17cc884ea6c10ad.zip |
colour for all blocks
-rwxr-xr-x | index.html | 48 |
1 files changed, 29 insertions, 19 deletions
@@ -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(); |