@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/react.cjs CHANGED
@@ -7380,6 +7380,10 @@ function verticalCornerDir(from, to) {
7380
7380
  function cornerRadiusFor(\u534A\u5F84, ...\u8D70\u308A) {
7381
7381
  return Math.min(\u534A\u5F84, ...\u8D70\u308A.map((v) => Math.abs(v)));
7382
7382
  }
7383
+ function runCrossesBox(\u8D70\u308A, \u7BB1) {
7384
+ if (\u8D70\u308A.y <= \u7BB1.cy - \u7BB1.h / 2 || \u8D70\u308A.y >= \u7BB1.cy + \u7BB1.h / 2) return false;
7385
+ 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);
7386
+ }
7383
7387
  var VERTICAL_DETOUR_EXIT = 45;
7384
7388
  function nearestBoxDistance(anchorX, dir, verticalTop, verticalBottom, boxes) {
7385
7389
  let nearest = Infinity;
@@ -8372,18 +8376,28 @@ function routePath(from, to, fromSide, toSide, obstacles = [], detourSide, _from
8372
8376
  const labelIntersect = oTop < labelBottom && oBottom > labelTop;
8373
8377
  return segIntersect || labelIntersect;
8374
8378
  };
8379
+ const \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B = (mx) => labelObstacles.some((o) => {
8380
+ if (o.id === from.id || o.id === to.id) return false;
8381
+ return runCrossesBox({ y: A.y, x1: A.x, x2: mx }, o) || runCrossesBox({ y: B.y, x1: mx, x2: B.x }, o);
8382
+ });
8375
8383
  let iter = 0;
8376
8384
  while (iter < 12) {
8377
8385
  const band = labelBand(midX2);
8378
- const hit = labelObstacles.find((o) => intersects(o, band));
8386
+ const hit = labelObstacles.find((o) => intersects(o, band)) ?? labelObstacles.find(
8387
+ (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))
8388
+ );
8379
8389
  if (!hit) break;
8380
8390
  const hitLeft = hit.cx - hit.w / 2;
8381
8391
  const hitRight = hit.cx + hit.w / 2;
8382
8392
  const retreatRight = hitRight + labelHalfW + CLEARANCE_NODE_LABEL + 4;
8383
8393
  const retreatLeft = hitLeft - labelHalfW - CLEARANCE_NODE_LABEL - 4;
8394
+ const \u53F3\u304C\u585E\u304C\u308B = \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B(retreatRight);
8395
+ const \u5DE6\u304C\u585E\u304C\u308B = \u6A2A\u306E\u8D70\u308A\u304C\u585E\u304C\u308B(retreatLeft);
8384
8396
  const dRight = Math.abs(retreatRight - midX2);
8385
8397
  const dLeft = Math.abs(retreatLeft - midX2);
8386
- midX2 = dRight <= dLeft ? retreatRight : retreatLeft;
8398
+ const \u6B21 = \u53F3\u304C\u585E\u304C\u308B === \u5DE6\u304C\u585E\u304C\u308B ? dRight <= dLeft ? retreatRight : retreatLeft : \u53F3\u304C\u585E\u304C\u308B ? retreatLeft : retreatRight;
8399
+ if (\u6B21 === midX2) break;
8400
+ midX2 = \u6B21;
8387
8401
  iter++;
8388
8402
  }
8389
8403
  }