From 8127f6baf782a5ccb56fb781b9006d7a0d5827fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kan=C4=9Bra?= Date: Tue, 17 Oct 2023 20:27:22 +0200 Subject: [PATCH] feat(routers.RightAngle): vertex in the target bbox improvements --- src/routers/rightAngle.mjs | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/routers/rightAngle.mjs b/src/routers/rightAngle.mjs index 2e633b21b..97581db86 100644 --- a/src/routers/rightAngle.mjs +++ b/src/routers/rightAngle.mjs @@ -681,7 +681,6 @@ function routeBetweenPoints(source, target) { if ((y < tcy || !isSourceEl) && y > tmy0 && sox > tx1) { y = tmy1; } - return [ { x: sox, y }, { x: tox, y }, @@ -689,28 +688,19 @@ function routeBetweenPoints(source, target) { ]; } return [{ x: sox, y: toy }]; + } else { + if (sx1 > tox) { + const y = Math.max(smy1, tmy1); + const x = Math.min(smx0, tmx0); + return [ + { x: sox, y }, + { x, y }, + { x, y: toy } + ]; + } } - const x = Math.min(tmx0, middleOfVerticalSides); - - if (sox < tox && sy0 <= toy) { - return [ - { x: sox, y: soy }, - { x, y: soy }, - { x, y: toy } - ]; - } - - if (x < smx1 && soy > ty0) { - const y = Math.max(smy1, tmy1); - const x = Math.min(smx0, tmx0); - - return [ - { x: sox, y }, - { x, y }, - { x, y: toy } - ]; - } + const x = middleOfVerticalSides; return [ { x: sox, y: soy },