Not moving the label away from assigned position
This commit is contained in:
parent
b244118fd9
commit
a82c53dd2e
|
@ -76,8 +76,12 @@ stateDiagram-v2
|
|||
</div>
|
||||
<div class="mermaid" style="width: 50%; height: 20%;">
|
||||
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#ff0000'}}}%%
|
||||
classDiagram
|
||||
Animal <|-- Duck
|
||||
flowchart TD
|
||||
%%subgraph A
|
||||
C -->|Label1 long long long| E1
|
||||
C --> E3
|
||||
C ==>E3
|
||||
%%end
|
||||
|
||||
</div>
|
||||
<div class="mermaid2" style="width: 50%; height: 20%;">
|
||||
|
|
|
@ -39,7 +39,7 @@ export const insertEdgeLabel = (elem, edge) => {
|
|||
edgeLabels[edge.id] = edgeLabel;
|
||||
|
||||
// Update the abstract data of the edge with the new information about its width and height
|
||||
edge.width = bbox.width + 40;
|
||||
edge.width = bbox.width;
|
||||
edge.height = bbox.height;
|
||||
|
||||
if (edge.startLabelLeft) {
|
||||
|
@ -111,10 +111,11 @@ export const positionEdgeLabel = (edge, paths) => {
|
|||
let x = edge.x;
|
||||
let y = edge.y;
|
||||
if (path) {
|
||||
// debugger;
|
||||
// // debugger;
|
||||
const pos = utils.calcLabelPosition(path);
|
||||
x = pos.x;
|
||||
y = pos.y;
|
||||
logger.info('Moving label from (', x, ',', y, ') to (', pos.x, ',', pos.y, ')');
|
||||
// x = pos.x;
|
||||
// y = pos.y;
|
||||
}
|
||||
el.attr('transform', 'translate(' + x + ', ' + y + ')');
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import mermaidAPI from '../../mermaidAPI';
|
|||
// const MERMAID_DOM_ID_PREFIX = 'mermaid-dom-id-';
|
||||
const MERMAID_DOM_ID_PREFIX = '';
|
||||
|
||||
let config = configApi.defaultConfig;
|
||||
let config = configApi.getConfig();
|
||||
let vertices = {};
|
||||
let edges = [];
|
||||
let classes = [];
|
||||
|
@ -48,7 +48,7 @@ export const addVertex = function(_id, text, type, style, classes) {
|
|||
vertices[id] = { id: id, styles: [], classes: [] };
|
||||
}
|
||||
if (typeof text !== 'undefined') {
|
||||
config = configApi.defaultConfig;
|
||||
config = configApi.getConfig();
|
||||
txt = common.sanitizeText(text.trim(), config);
|
||||
|
||||
// strip quotes if string starts and ends with a quote
|
||||
|
|
Loading…
Reference in New Issue