mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-12-03 02:54:06 +01:00
Fix for turned arrow heads and missing edge sections
This commit is contained in:
@@ -429,22 +429,19 @@ export const insertEdge = function (elem, edge, clusterDb, diagramType, startNod
|
||||
const tail = startNode;
|
||||
var head = endNode;
|
||||
|
||||
if (head.intersect && tail.intersect && points.length > 2) {
|
||||
const initialStartPoint = Object.assign({}, points[0]);
|
||||
const newEnd = head.intersect(points[points.length - 2]);
|
||||
|
||||
const newStart = tail.intersect(points[1]);
|
||||
if (newStart.x && newStart.y) {
|
||||
points.unshift(newStart);
|
||||
} else {
|
||||
points.unshift(initialStartPoint);
|
||||
}
|
||||
if (newEnd.x && newEnd.y) {
|
||||
const lastPoint = points[points.length - 1];
|
||||
if (lastPoint.x !== newEnd.x && lastPoint.y !== newEnd.y) {
|
||||
points.push(newEnd);
|
||||
}
|
||||
}
|
||||
if (head.intersect && tail.intersect) {
|
||||
points = points.slice(1, edge.points.length - 1);
|
||||
points.unshift(tail.intersect(points[0]));
|
||||
log.debug(
|
||||
'Last point APA12',
|
||||
edge.start,
|
||||
'-->',
|
||||
edge.end,
|
||||
points[points.length - 1],
|
||||
head,
|
||||
head.intersect(points[points.length - 1])
|
||||
);
|
||||
points.push(head.intersect(points[points.length - 1]));
|
||||
}
|
||||
if (edge.toCluster) {
|
||||
log.info('to cluster abc88', clusterDb.get(edge.toCluster));
|
||||
|
||||
@@ -103,7 +103,7 @@ export const cylinder = async (parent: SVGAElement, node: Node) => {
|
||||
Math.abs(pos.y - (node.y ?? 0)) > (node.height ?? 0) / 2 - ry))
|
||||
) {
|
||||
let y = ry * ry * (1 - (x * x) / (rx * rx));
|
||||
if (y != 0) {
|
||||
if (y > 0) {
|
||||
y = Math.sqrt(y);
|
||||
}
|
||||
y = ry - y;
|
||||
|
||||
@@ -65,7 +65,7 @@ export const styles2String = (node: Node) => {
|
||||
labelStyles.push(style.join(':') + ' !important');
|
||||
} else {
|
||||
nodeStyles.push(style.join(':') + ' !important');
|
||||
if (key === 'stroke' || key === 'stroke-width') {
|
||||
if (key.includes('stroke')) {
|
||||
borderStyles.push(style.join(':') + ' !important');
|
||||
}
|
||||
if (key === 'fill') {
|
||||
|
||||
Reference in New Issue
Block a user