mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-03 23:56:44 +02:00
Sequence diagram loop margins
Handling of arrows to the left in loops in sequence diagrams Addition of labels
This commit is contained in:
@@ -19,7 +19,8 @@ exports.drawText = function(elem , textData){
|
||||
var textElem = elem.append('text');
|
||||
textElem.attr('x', textData.x);
|
||||
textElem.attr('y', textData.y);
|
||||
textElem.style('text-anchor', 'start');
|
||||
textElem.style('text-anchor', textData.anchor);
|
||||
textElem.style('fill', textData.fill);
|
||||
|
||||
textData.text.split('<br>').forEach(function(rowText){
|
||||
var span = textElem.append('tspan');
|
||||
@@ -31,14 +32,37 @@ exports.drawText = function(elem , textData){
|
||||
return textElem;
|
||||
};
|
||||
|
||||
exports.drawLabel = function(elem , txtObject){
|
||||
var rectData = exports.getNoteRect();
|
||||
rectData.x = txtObject.x;
|
||||
rectData.y = txtObject.y;
|
||||
rectData.width = 50;
|
||||
rectData.height = 20;
|
||||
rectData.fill = '#339933';
|
||||
rectData.stroke = 'none';
|
||||
//rectData.color = 'white';
|
||||
|
||||
var label = exports.drawRect(elem, rectData);
|
||||
|
||||
txtObject.y = txtObject.y + txtObject.labelMargin;
|
||||
txtObject.x = txtObject.x + 0.5*txtObject.labelMargin;
|
||||
txtObject.fill = 'white';
|
||||
exports.drawText(elem, txtObject);
|
||||
|
||||
//return textElem;
|
||||
};
|
||||
|
||||
|
||||
exports.getTextObj = function(){
|
||||
var rect = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
'fill':'black',
|
||||
'text-anchor': 'start',
|
||||
style: '#666',
|
||||
width: 100,
|
||||
height: 100,
|
||||
textMargin:0,
|
||||
rx: 0,
|
||||
ry: 0
|
||||
};
|
||||
@@ -52,6 +76,7 @@ exports.getNoteRect = function(){
|
||||
fill: '#EDF2AE',
|
||||
stroke: '#666',
|
||||
width: 100,
|
||||
anchor:'start',
|
||||
height: 100,
|
||||
rx: 0,
|
||||
ry: 0
|
||||
|
Reference in New Issue
Block a user