@cardenelabs/cdl 0.65.0 → 0.66.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -18758,6 +18758,10 @@ function verticalCornerDir(from, to) {
18758
18758
  function cornerRadiusFor(\u534A\u5F84, ...\u8D70\u308A) {
18759
18759
  return Math.min(\u534A\u5F84, ...\u8D70\u308A.map((v) => Math.abs(v)));
18760
18760
  }
18761
+ function runCrossesBox(\u8D70\u308A, \u7BB1) {
18762
+ if (\u8D70\u308A.y <= \u7BB1.cy - \u7BB1.h / 2 || \u8D70\u308A.y >= \u7BB1.cy + \u7BB1.h / 2) return false;
18763
+ return \u7BB1.cx + \u7BB1.w / 2 > Math.min(\u8D70\u308A.x1, \u8D70\u308A.x2) && \u7BB1.cx - \u7BB1.w / 2 < Math.max(\u8D70\u308A.x1, \u8D70\u308A.x2);
18764
+ }
18761
18765
  var VERTICAL_DETOUR_EXIT = 45;
18762
18766
  function nearestBoxDistance(anchorX, dir, verticalTop, verticalBottom, boxes) {
18763
18767
  let nearest = Infinity;
@@ -19750,18 +19754,28 @@ function routePath(from, to, fromSide, toSide, obstacles = [], detourSide, _from
19750
19754
  const labelIntersect = oTop < labelBottom && oBottom > labelTop;
19751
19755
  return segIntersect || labelIntersect;
19752
19756
  };
19757
+ const \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B = (mx) => labelObstacles.some((o) => {
19758
+ if (o.id === from.id || o.id === to.id) return false;
19759
+ return runCrossesBox({ y: A.y, x1: A.x, x2: mx }, o) || runCrossesBox({ y: B.y, x1: mx, x2: B.x }, o);
19760
+ });
19753
19761
  let iter = 0;
19754
19762
  while (iter < 12) {
19755
19763
  const band = labelBand(midX2);
19756
- const hit = labelObstacles.find((o) => intersects(o, band));
19764
+ const hit = labelObstacles.find((o) => intersects(o, band)) ?? labelObstacles.find(
19765
+ (o) => o.id !== from.id && o.id !== to.id && (runCrossesBox({ y: A.y, x1: A.x, x2: midX2 }, o) || runCrossesBox({ y: B.y, x1: midX2, x2: B.x }, o))
19766
+ );
19757
19767
  if (!hit) break;
19758
19768
  const hitLeft = hit.cx - hit.w / 2;
19759
19769
  const hitRight = hit.cx + hit.w / 2;
19760
19770
  const retreatRight = hitRight + labelHalfW + CLEARANCE_NODE_LABEL + 4;
19761
19771
  const retreatLeft = hitLeft - labelHalfW - CLEARANCE_NODE_LABEL - 4;
19772
+ const \u53F3\u304C\u585E\u304C\u308B = \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B(retreatRight);
19773
+ const \u5DE6\u304C\u585E\u304C\u308B = \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B(retreatLeft);
19762
19774
  const dRight = Math.abs(retreatRight - midX2);
19763
19775
  const dLeft = Math.abs(retreatLeft - midX2);
19764
- midX2 = dRight <= dLeft ? retreatRight : retreatLeft;
19776
+ const \u6B21 = \u53F3\u304C\u585E\u304C\u308B === \u5DE6\u304C\u585E\u304C\u308B ? dRight <= dLeft ? retreatRight : retreatLeft : \u53F3\u304C\u585E\u304C\u308B ? retreatLeft : retreatRight;
19777
+ if (\u6B21 === midX2) break;
19778
+ midX2 = \u6B21;
19765
19779
  iter++;
19766
19780
  }
19767
19781
  }