Added class definitions to nodes

Removed the inline styling of nodes with classes, replaced with class
attributes and a common CSS Style section at the start of the SVG.
This commit is contained in:
Björn Weström
2014-12-14 00:32:27 +01:00
parent 71fd8e1b70
commit 3fcbc7ae56
10 changed files with 238 additions and 91 deletions

View File

@@ -41,23 +41,27 @@ var init = function () {
txt = txt.replace(/</g,'&lt;');
txt = he.decode(txt).trim();
element.innerHTML = '<svg id="' + id + '">' +
'<g />' +
'</svg>';
element.innerHTML = '<svg id="' + id + '" width="100%">' +
'<g />' +
'</svg>';
var graphType = utils.detectType(txt);
switch(graphType){
case 'graph':
console.log('FC');
flowRenderer.draw(txt, id,false);
flowRenderer.draw(txt, id, false);
utils.cloneCssStyles(element.firstChild, flowRenderer.defaultNodeStyle());
graph.bindFunctions();
break;
case 'dotGraph':
flowRenderer.draw(txt, id,true);
utils.cloneCssStyles(element.firstChild, flowRenderer.defaultNodeStyle());
break;
case 'sequenceDiagram':
seq.draw(txt,id);
// TODO - Get default styles for sequence diagram
utils.cloneCssStyles(element.firstChild, flowRenderer.defaultNodeStyle());
break;
}