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; const tail = startNode;
var head = endNode; var head = endNode;
if (head.intersect && tail.intersect && points.length > 2) { if (head.intersect && tail.intersect) {
const initialStartPoint = Object.assign({}, points[0]); points = points.slice(1, edge.points.length - 1);
const newEnd = head.intersect(points[points.length - 2]); points.unshift(tail.intersect(points[0]));
log.debug(
const newStart = tail.intersect(points[1]); 'Last point APA12',
if (newStart.x && newStart.y) { edge.start,
points.unshift(newStart); '-->',
} else { edge.end,
points.unshift(initialStartPoint); points[points.length - 1],
} head,
if (newEnd.x && newEnd.y) { head.intersect(points[points.length - 1])
const lastPoint = points[points.length - 1]; );
if (lastPoint.x !== newEnd.x && lastPoint.y !== newEnd.y) { points.push(head.intersect(points[points.length - 1]));
points.push(newEnd);
}
}
} }
if (edge.toCluster) { if (edge.toCluster) {
log.info('to cluster abc88', clusterDb.get(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)) Math.abs(pos.y - (node.y ?? 0)) > (node.height ?? 0) / 2 - ry))
) { ) {
let y = ry * ry * (1 - (x * x) / (rx * rx)); let y = ry * ry * (1 - (x * x) / (rx * rx));
if (y != 0) { if (y > 0) {
y = Math.sqrt(y); y = Math.sqrt(y);
} }
y = ry - y; y = ry - y;

View File

@@ -65,7 +65,7 @@ export const styles2String = (node: Node) => {
labelStyles.push(style.join(':') + ' !important'); labelStyles.push(style.join(':') + ' !important');
} else { } else {
nodeStyles.push(style.join(':') + ' !important'); nodeStyles.push(style.join(':') + ' !important');
if (key === 'stroke' || key === 'stroke-width') { if (key.includes('stroke')) {
borderStyles.push(style.join(':') + ' !important'); borderStyles.push(style.join(':') + ' !important');
} }
if (key === 'fill') { if (key === 'fill') {