mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-02-04 07:13:25 +08:00
Fix for issue #3882 moving the label when the path has been modified
This commit is contained in:
parent
b68fee7e65
commit
4124d186d0
@ -57,22 +57,28 @@
|
|||||||
<div>Security check</div>
|
<div>Security check</div>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
flowchart LR
|
flowchart LR
|
||||||
subgraph external
|
%% Actors
|
||||||
subgraph internal
|
A
|
||||||
inside
|
subgraph Sub
|
||||||
end
|
B --> C
|
||||||
end
|
end
|
||||||
outside --> inside
|
|
||||||
|
%% Accusations
|
||||||
|
A --L --> Sub
|
||||||
|
|
||||||
|
%% Offense
|
||||||
|
B --> A
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
flowchart LR
|
stateDiagram-v2
|
||||||
subgraph parent
|
|
||||||
subgraph childB
|
[*] --> S1
|
||||||
grandchild
|
S1 --> S2: long line using<br/>should work
|
||||||
end
|
S1 --> S3: long line using <br>should work
|
||||||
end
|
S1 --> S4: long line using \\nshould work
|
||||||
foo --> childA </pre
|
|
||||||
>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid2">
|
<pre id="diagram" class="mermaid2">
|
||||||
gantt
|
gantt
|
||||||
title Style today marker (vertical line should be 5px wide and half-transparent blue)
|
title Style today marker (vertical line should be 5px wide and half-transparent blue)
|
||||||
|
@ -130,9 +130,21 @@ export const positionEdgeLabel = (edge, paths) => {
|
|||||||
if (path) {
|
if (path) {
|
||||||
// // debugger;
|
// // debugger;
|
||||||
const pos = utils.calcLabelPosition(path);
|
const pos = utils.calcLabelPosition(path);
|
||||||
log.info('Moving label from (', x, ',', y, ') to (', pos.x, ',', pos.y, ') abc78');
|
log.info(
|
||||||
// x = pos.x;
|
'Moving label ' + edge.label + ' from (',
|
||||||
// y = pos.y;
|
x,
|
||||||
|
',',
|
||||||
|
y,
|
||||||
|
') to (',
|
||||||
|
pos.x,
|
||||||
|
',',
|
||||||
|
pos.y,
|
||||||
|
') abc78'
|
||||||
|
);
|
||||||
|
if (paths.updatedPath) {
|
||||||
|
x = pos.x;
|
||||||
|
y = pos.y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
el.attr('transform', 'translate(' + x + ', ' + y + ')');
|
el.attr('transform', 'translate(' + x + ', ' + y + ')');
|
||||||
}
|
}
|
||||||
@ -463,7 +475,7 @@ export const insertEdge = function (elem, e, edge, clusterDb, diagramType, graph
|
|||||||
.attr('style', edge.style);
|
.attr('style', edge.style);
|
||||||
|
|
||||||
// DEBUG code, adds a red circle at each edge coordinate
|
// DEBUG code, adds a red circle at each edge coordinate
|
||||||
// edge.points.forEach(point => {
|
// edge.points.forEach((point) => {
|
||||||
// elem
|
// elem
|
||||||
// .append('circle')
|
// .append('circle')
|
||||||
// .style('stroke', 'red')
|
// .style('stroke', 'red')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user