mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-14 17:54:13 +01:00
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { logger } from '../logger'; // eslint-disable-line
|
||||
import createLabel from './createLabel';
|
||||
import { line, curveBasis } from 'd3';
|
||||
import { line, curveBasis, select } from 'd3';
|
||||
import { getConfig } from '../config';
|
||||
|
||||
let edgeLabels = {};
|
||||
@@ -21,7 +21,14 @@ export const insertEdgeLabel = (elem, edge) => {
|
||||
label.node().appendChild(labelElement);
|
||||
|
||||
// Center the label
|
||||
const bbox = labelElement.getBBox();
|
||||
let bbox = labelElement.getBBox();
|
||||
if (getConfig().flowchart.htmlLabels) {
|
||||
const div = labelElement.children[0];
|
||||
const dv = select(labelElement);
|
||||
bbox = div.getBoundingClientRect();
|
||||
dv.attr('width', bbox.width);
|
||||
dv.attr('height', bbox.height);
|
||||
}
|
||||
label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')');
|
||||
|
||||
// Make element accessible by id for positioning
|
||||
|
||||
Reference in New Issue
Block a user