From 69ab3cbceb9c9efa281e3ec6e17cc884ea6c10ad Mon Sep 17 00:00:00 2001 From: Pooja Soundalgekar Date: Tue, 12 Jul 2016 23:37:21 +0530 Subject: colour for all blocks --- index.html | 48 +++++++++++++++++++++++++++++------------------- 1 file 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(); -- cgit