From cfd0c5c2cd23d40e16af772e959916f49f3b5fa6 Mon Sep 17 00:00:00 2001 From: jiteshjha Date: Tue, 5 Jul 2016 18:12:20 +0530 Subject: showColorWheel() function now works --- index.html | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'index.html') diff --git a/index.html b/index.html index a7d1a00..4b7adce 100644 --- a/index.html +++ b/index.html @@ -743,7 +743,7 @@ if (mxUtils.isNode(cell.value)) { var stylesheet = graph.getStylesheet(); - var style = stylesheet.styles[cell.style]; + var style = stylesheet.styles[cell.value.getAttribute('style')]; var displayedLabel = style['displayedLabel']; if(displayedLabel != null) { var displayParameter = cell.blockInstance.instance.displayParameter; @@ -1214,6 +1214,9 @@ */ function styleToObject(style) { + if(style.indexOf(';') == -1) { + style = style + ';'; + } var defaultStyle = style.substring(0, style.indexOf(';')); var styleObject = { @@ -1622,7 +1625,7 @@ var trigger = document.getElementById(button); var styleObject = styleToObject(style); var previousValue = 1; - if ('fontStyle' in styleObjesct) { + if ('fontStyle' in styleObject) { previousValue = styleObject['fontStyle']; // To get a bit mask: @@ -1950,7 +1953,11 @@ btn.onclick = function() { var input = document.getElementById('color').value; var style = graph.getModel().getStyle(cell); - var styleObject = styleToObject(style); + + if(style != null) { + var styleObject = styleToObject(style); + } + if (selectProperty == "edgeStrokeColor") { styleObject['strokeColor'] = input; } else if (selectProperty == "bgColor") { @@ -1962,8 +1969,12 @@ } else if (selectProperty == "edgeTextColor") { styleObject['fontColor'] = input; } - style = objectToStyle(styleObject); - graph.getModel().setStyle(cell, style); + + if(style != null) { + style = objectToStyle(styleObject); + graph.getModel().setStyle(cell, style); + } + wind.destroy(); }; myform.appendChild(btn); -- cgit