Fix for turned arrow heads and missing edge sections

This commit is contained in:
Knut Sveidqvist
2024-08-23 09:42:02 +02:00
parent 09afb077f0
commit 46b7ee87dd
3 changed files with 15 additions and 18 deletions

View File

@@ -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));

View File

@@ -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;

View File

@@ -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') {