@cardenelabs/cdl 0.21.0 → 0.21.1

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
@@ -13090,8 +13090,12 @@ function resolveEdgeLabelOverlapsWithChainAndPropagate(edges, obstacles, minClea
13090
13090
  for (const { p } of ordered) {
13091
13091
  const axis = p.axis;
13092
13092
  if (!pathShiftIsSafe(e.id, axis, p.sign, amount)) continue;
13093
+ const \u52D5\u304B\u3057\u305F\u5F8C = measurePathLabelGapSegs(
13094
+ simulateShiftedSegments(e, axis === "x" ? p.sign * amount : 0, axis === "y" ? p.sign * amount : 0),
13095
+ label
13096
+ );
13093
13097
  out.push({ target: { kind: "edge-path", id: e.id }, axis, sign: p.sign, amount });
13094
- \u7DDA\u3092\u52D5\u304B\u305B\u305F = true;
13098
+ \u7DDA\u3092\u52D5\u304B\u305B\u305F = \u52D5\u304B\u3057\u305F\u5F8C > gap;
13095
13099
  break;
13096
13100
  }
13097
13101
  if (!\u7DDA\u3092\u52D5\u304B\u305B\u305F) {
@@ -13114,16 +13118,49 @@ function resolveEdgeLabelOverlapsWithChainAndPropagate(edges, obstacles, minClea
13114
13118
  if (\u8FD1\u3044\u70B9) {
13115
13119
  const dx = \u82AF.x - \u8FD1\u3044\u70B9.x;
13116
13120
  const dy = \u82AF.y - \u8FD1\u3044\u70B9.y;
13117
- const axis = Math.abs(dx) >= Math.abs(dy) ? "x" : "y";
13118
- const \u5411\u304D = axis === "x" ? dx : dy;
13119
- const sign = \u5411\u304D >= 0 ? 1 : -1;
13120
- out.push({
13121
- target: { kind: "label", id: label.id },
13122
- axis,
13123
- sign,
13124
- amount: pathLabelClearance - gap + NEAR_MISS_MARGIN,
13125
- chain: false
13121
+ const \u91CF = pathLabelClearance - gap + NEAR_MISS_MARGIN;
13122
+ const \u5019\u88DC = Math.abs(dx) >= Math.abs(dy) ? [
13123
+ { axis: "x", sign: dx >= 0 ? 1 : -1 },
13124
+ { axis: "y", sign: dy >= 0 ? 1 : -1 }
13125
+ ] : [
13126
+ { axis: "y", sign: dy >= 0 ? 1 : -1 },
13127
+ { axis: "x", sign: dx >= 0 ? 1 : -1 }
13128
+ ];
13129
+ const \u52D5\u304B\u3057\u305F\u7BB1 = (axis, sign) => ({
13130
+ ...label,
13131
+ x: label.x + (axis === "x" ? sign * \u91CF : 0),
13132
+ y: label.y + (axis === "y" ? sign * \u91CF : 0)
13126
13133
  });
13134
+ const \u7DDA\u3054\u3068\u306E\u8DDD\u96E2 = (\u7BB1) => {
13135
+ const \u51FA = /* @__PURE__ */ new Map();
13136
+ for (const \u4ED6 of edges) {
13137
+ if (\u4ED6.id === label.id) continue;
13138
+ const segs2 = segmentsExcludingOwnPath(shiftedSegments(\u4ED6.id, \u4ED6.d), ownSegsOf(label.id));
13139
+ if (segs2.length === 0) continue;
13140
+ \u51FA.set(\u4ED6.id, measurePathLabelGapSegs(segs2, \u7BB1));
13141
+ }
13142
+ return \u51FA;
13143
+ };
13144
+ const \u3044\u307E\u306E\u8DDD\u96E2 = \u7DDA\u3054\u3068\u306E\u8DDD\u96E2(label);
13145
+ const \u60AA\u304F\u3059\u308B = (\u7BB1) => {
13146
+ const \u5F8C = \u7DDA\u3054\u3068\u306E\u8DDD\u96E2(\u7BB1);
13147
+ for (const [id, \u524D\u306E\u5024] of \u3044\u307E\u306E\u8DDD\u96E2) {
13148
+ const \u5F8C\u306E\u5024 = \u5F8C.get(id) ?? Infinity;
13149
+ if (\u5F8C\u306E\u5024 < Math.min(\u524D\u306E\u5024, pathLabelClearance)) return true;
13150
+ }
13151
+ return false;
13152
+ };
13153
+ for (const \u5019 of \u5019\u88DC) {
13154
+ if (\u60AA\u304F\u3059\u308B(\u52D5\u304B\u3057\u305F\u7BB1(\u5019.axis, \u5019.sign))) continue;
13155
+ out.push({
13156
+ target: { kind: "label", id: label.id },
13157
+ axis: \u5019.axis,
13158
+ sign: \u5019.sign,
13159
+ amount: \u91CF,
13160
+ chain: false
13161
+ });
13162
+ break;
13163
+ }
13127
13164
  }
13128
13165
  }
13129
13166
  }