Skip to content

Commit 9b6e6cd

Browse files
committed
new version
1 parent 2aa7fa1 commit 9b6e6cd

File tree

1 file changed

+45
-5
lines changed

1 file changed

+45
-5
lines changed

flowchart-latest.js

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// flowchart, v1.2.8
1+
// flowchart, v1.2.9
22
// Copyright (c)2014 Adriano Raiano (adrai).
33
// Distributed under MIT license
44
// http://adrai.github.io/flowchart.js
@@ -93,6 +93,9 @@
9393
'text-margin': 10,
9494
'font-size': 14,
9595
'font-color': 'black',
96+
// 'font': 'normal',
97+
// 'font-family': 'calibri',
98+
// 'font-weight': 'normal',
9699
'line-color': 'black',
97100
'element-color': 'black',
98101
'fill': 'white',
@@ -172,6 +175,15 @@
172175
var symbol = chart.paper.path(path, pathValues);
173176
symbol.attr('stroke', chart.options['element-color']);
174177
symbol.attr('stroke-width', chart.options['line-width']);
178+
179+
var font = chart.options['font'];
180+
var fontF = chart.options['font-family'];
181+
var fontW = chart.options['font-weight'];
182+
183+
if (font) symbol.attr({ 'font': font });
184+
if (fontF) symbol.attr({ 'font-family': fontF });
185+
if (fontW) symbol.attr({ 'font-weight': fontW });
186+
175187
return symbol;
176188
}
177189

@@ -199,6 +211,14 @@
199211
'arrow-end': chart.options['arrow-end']
200212
});
201213

214+
var font = chart.options['font'];
215+
var fontF = chart.options['font-family'];
216+
var fontW = chart.options['font-weight'];
217+
218+
if (font) line.attr({ 'font': font });
219+
if (fontF) line.attr({ 'font-family': fontF });
220+
if (fontW) line.attr({ 'font-weight': fontW });
221+
202222
if (text) {
203223

204224
var centerText = false;
@@ -255,6 +275,10 @@
255275
x: x,
256276
y: y
257277
});
278+
279+
if (font) textPath.attr({ 'font': font });
280+
if (fontF) textPath.attr({ 'font-family': fontF });
281+
if (fontW) textPath.attr({ 'font-weight': fontW });
258282
}
259283

260284
return line;
@@ -417,6 +441,15 @@
417441
'x': (this.chart.options.symbols[this.symbolType]['text-margin'] || this.chart.options['text-margin']),
418442
stroke: (this.chart.options.symbols[this.symbolType]['font-color'] || this.chart.options['font-color'])
419443
});
444+
445+
var font = (this.chart.options.symbols[this.symbolType]['font'] || this.chart.options['font']);
446+
var fontF = (this.chart.options.symbols[this.symbolType]['font-family'] || this.chart.options['font-family']);
447+
var fontW = (this.chart.options.symbols[this.symbolType]['font-weight'] || this.chart.options['font-weight']);
448+
449+
if (font) this.text.attr({ 'font': font });
450+
if (fontF) this.text.attr({ 'font-family': fontF });
451+
if (fontW) this.text.attr({ 'font-weight': fontW });
452+
420453
if (options.link) { this.text.attr('href', options.link); }
421454
if (options.target) { this.text.attr('target', options.target); }
422455
if (this.chart.options.symbols[this.symbolType]['maxWidth'] || this.chart.options['maxWidth']) {
@@ -691,14 +724,12 @@
691724
maxX = right.x + lineLength/2;
692725
} else if ((origin && origin === 'right') && isRight) {
693726
line = drawLine(this.chart, right, [
694-
{x: symbolRight.x + lineLength/2, y: right.y},
695-
{x: symbolRight.x + lineLength/2, y: symbolTop.y - lineLength/2},
696-
{x: symbolTop.x, y: symbolTop.y - lineLength/2},
727+
{x: symbolTop.x, y: right.y},
697728
{x: symbolTop.x, y: symbolTop.y}
698729
], text);
699730
this.rightStart = true;
700731
symbol.topEnd = true;
701-
maxX = symbolRight.x + lineLength/2;
732+
maxX = right.x + lineLength/2;
702733
} else if ((origin && origin === 'bottom') && isOnSameColumn && isUpper) {
703734
line = drawLine(this.chart, bottom, [
704735
{x: bottom.x, y: bottom.y + lineLength/2},
@@ -868,6 +899,15 @@
868899
height: this.text.getBBox().height + 2 * (this.chart.options.symbols[this.symbolType]['text-margin'] || this.chart.options['text-margin']),
869900
fill: (this.chart.options.symbols[this.symbolType]['fill'] || this.chart.options['fill'])
870901
});
902+
903+
var font = (this.chart.options.symbols[this.symbolType]['font'] || this.chart.options['font']);
904+
var fontF = (this.chart.options.symbols[this.symbolType]['font-family'] || this.chart.options['font-family']);
905+
var fontW = (this.chart.options.symbols[this.symbolType]['font-weight'] || this.chart.options['font-weight']);
906+
907+
if (font) innerWrap.attr({ 'font': font });
908+
if (fontF) innerWrap.attr({ 'font-family': fontF });
909+
if (fontW) innerWrap.attr({ 'font-weight': fontW });
910+
871911
if (options.link) { innerWrap.attr('href', options.link); }
872912
if (options.target) { innerWrap.attr('target', options.target); }
873913
this.group.push(innerWrap);

0 commit comments

Comments
 (0)