summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();