mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-02 23:26:44 +02:00
Fix for problem with text definitions being overridden by empty strings.
This commit is contained in:
@@ -38,8 +38,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mermaid">
|
<div class="mermaid">
|
||||||
a[Lasa bok]-->b;
|
a[Lasa bok]-->b;
|
||||||
b-->c(Vidar)|Klocka;
|
b{Fundera}-->c(Vidar)|Klocka;
|
||||||
b{Fundera}-->d(Bjarke)|Lego;
|
b-->d(Bjarke)|Lego;
|
||||||
|
style a background:#aaa;
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@@ -21,7 +21,7 @@ define(['parser/graph','parser/mermaid'],function(graph,parser){
|
|||||||
g.setNode(vertice.id, { label: verticeText,rx:5,ry:5 });
|
g.setNode(vertice.id, { label: verticeText,rx:5,ry:5 });
|
||||||
}else{
|
}else{
|
||||||
if(vertice.type==='diamond'){
|
if(vertice.type==='diamond'){
|
||||||
g.setNode(vertice.id, {shape: "house", label: verticeText,rx:0,ry:0 });
|
g.setNode(vertice.id, {shape: "house", label: verticeText,rx:0,ry:0,style: "fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;" });
|
||||||
}else{
|
}else{
|
||||||
g.setNode(vertice.id, { label: verticeText,rx:0,ry:0 });
|
g.setNode(vertice.id, { label: verticeText,rx:0,ry:0 });
|
||||||
}
|
}
|
||||||
|
@@ -6,13 +6,14 @@ define('parser/graph',function() {
|
|||||||
var edges = [];
|
var edges = [];
|
||||||
var graph = {
|
var graph = {
|
||||||
addVertex: function (id, text, type, style) {
|
addVertex: function (id, text, type, style) {
|
||||||
|
console.log('Got node ' + id + ' ' + type + ' ' + text + ' styles: ' + JSON.stringify(style));
|
||||||
if(typeof vertices[id] === 'undefined'){
|
if(typeof vertices[id] === 'undefined'){
|
||||||
vertices[id]={id:id, styles:[]};
|
vertices[id]={id:id, styles:[]};
|
||||||
}
|
}
|
||||||
if(typeof text !== undefined){
|
if(typeof text !== 'undefined'){
|
||||||
vertices[id].text = text;
|
vertices[id].text = text;
|
||||||
}
|
}
|
||||||
if(typeof type !== undefined){
|
if(typeof type !== 'undefined'){
|
||||||
vertices[id].type = type;
|
vertices[id].type = type;
|
||||||
}
|
}
|
||||||
if(typeof style !== 'undefined'){
|
if(typeof style !== 'undefined'){
|
||||||
@@ -23,7 +24,6 @@ define('parser/graph',function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//console.log('Got node ' + id + ' ' + type + ' ' + text + ' styles: ' + JSON.stringify(style));
|
|
||||||
},
|
},
|
||||||
getVertices:function(){
|
getVertices:function(){
|
||||||
return vertices;
|
return vertices;
|
||||||
|
Reference in New Issue
Block a user