From 157a723711cabd0d5643bf5609d0f718544d1a5f Mon Sep 17 00:00:00 2001 From: Ayabusa Date: Sat, 28 Mar 2026 09:10:02 +0100 Subject: [PATCH] Fixed arrows --- projects/script.js | 13 +++++++++++-- projects/style.css | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/projects/script.js b/projects/script.js index 21f9451..41903eb 100644 --- a/projects/script.js +++ b/projects/script.js @@ -28,11 +28,20 @@ const pathEls = CONNECTIONS.map(() => { // r1 = bounding rect of source, r2 = bounding rect of target // Both rects are relative to the scene container. function manhattanPath(r1, r2) { - const x1 = r1.left + r1.width / 2; // bottom-center of source + let x1 = r1.left + r1.width / 2; // bottom-center of source const y1 = r1.top + r1.height + 10; - const x2 = r2.left + r2.width / 2; // top-center of target + let x2 = r2.left + r2.width / 2; // top-center of target const y2 = r2.top + 5; // stop 8px above target (arrowhead gap) + let shift = 5; + if (x1 > x2) { + x1 -= shift; + x2 += shift; + } else if (x2 > x1) { + x1 += shift; + x2 -= shift; + } + const ymid = y1 + (y2 - y1) / 2; // elbow halfway between the two // M: move to source bottom diff --git a/projects/style.css b/projects/style.css index 5e7cba8..5fcaec3 100644 --- a/projects/style.css +++ b/projects/style.css @@ -26,6 +26,7 @@ a { font-family: "fmono"; max-width: 300px; filter: drop-shadow(5px 5px 4px #707070); + height: fit-content; } .disboxp {