@cardenelabs/cdl 0.42.0 → 0.43.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
@@ -20215,7 +20215,8 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
20215
20215
  const nodeById = new Map(nodes.map((n) => [n.id, n]));
20216
20216
  const sortedByX = [...layoutedLanes].sort((a, b) => a.x - b.x);
20217
20217
  const laneIndexById = new Map(sortedByX.map((lane, i) => [lane.id, i]));
20218
- const requiredBoxWByPair = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
20218
+ const requiredBoxWAdjacent = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
20219
+ const requiredBoxWSpanning = new Array(Math.max(0, sortedByX.length - 1)).fill(0);
20219
20220
  for (const edge of edges) {
20220
20221
  const fromLane = nodeById.get(edge.from)?.lane;
20221
20222
  const toLane = nodeById.get(edge.to)?.lane;
@@ -20227,23 +20228,33 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
20227
20228
  if (labelBoxW === 0) continue;
20228
20229
  const lo = Math.min(fi, ti);
20229
20230
  const hi = Math.max(fi, ti);
20231
+ const \u8981\u6C42 = hi - lo === 1 ? requiredBoxWAdjacent : requiredBoxWSpanning;
20230
20232
  for (let pair = lo; pair < hi; pair++) {
20231
- if (labelBoxW > requiredBoxWByPair[pair]) requiredBoxWByPair[pair] = labelBoxW;
20233
+ if (labelBoxW > \u8981\u6C42[pair]) \u8981\u6C42[pair] = labelBoxW;
20232
20234
  }
20233
20235
  }
20236
+ const \u7BB1\u306E\u534A\u5E45 = /* @__PURE__ */ new Map();
20237
+ for (const n of nodes) {
20238
+ const \u4ECA = \u7BB1\u306E\u534A\u5E45.get(n.lane) ?? 0;
20239
+ if (n.w / 2 > \u4ECA) \u7BB1\u306E\u534A\u5E45.set(n.lane, n.w / 2);
20240
+ }
20234
20241
  const requiredPitchByPair = [];
20235
20242
  for (let i = 0; i < sortedByX.length - 1; i++) {
20236
20243
  const lane = sortedByX[i];
20237
20244
  const rightLane = sortedByX[i + 1];
20238
- const halfSum = lane.width / 2 + rightLane.width / 2;
20245
+ const laneHalfSum = lane.width / 2 + rightLane.width / 2;
20246
+ const nodeHalfSum = (\u7BB1\u306E\u534A\u5E45.get(lane.id) ?? 0) + (\u7BB1\u306E\u534A\u5E45.get(rightLane.id) ?? 0);
20239
20247
  const currentPitch = rightLane.x + rightLane.width / 2 - (lane.x + lane.width / 2);
20240
- const maxLabelBoxW = requiredBoxWByPair[i];
20241
- if (maxLabelBoxW === 0) {
20248
+ const \u96A3 = requiredBoxWAdjacent[i];
20249
+ const \u8DE8 = requiredBoxWSpanning[i];
20250
+ if (\u96A3 === 0 && \u8DE8 === 0) {
20242
20251
  requiredPitchByPair.push(currentPitch);
20243
20252
  continue;
20244
20253
  }
20245
- const requiredGap = maxLabelBoxW + CLEARANCE_NODE_LABEL * 2 + EDGE_STUB_OUT * 2;
20246
- requiredPitchByPair.push(Math.max(currentPitch, requiredGap + halfSum));
20254
+ const \u4E0A\u4E57\u305B = CLEARANCE_NODE_LABEL * 2 + EDGE_STUB_OUT * 2;
20255
+ const \u96A3\u306E\u8981\u6C42 = \u96A3 === 0 ? 0 : \u96A3 + \u4E0A\u4E57\u305B + nodeHalfSum;
20256
+ const \u8DE8\u306E\u8981\u6C42 = \u8DE8 === 0 ? 0 : \u8DE8 + \u4E0A\u4E57\u305B + laneHalfSum;
20257
+ requiredPitchByPair.push(Math.max(currentPitch, \u96A3\u306E\u8981\u6C42, \u8DE8\u306E\u8981\u6C42));
20247
20258
  }
20248
20259
  const targetPitch = Math.ceil(Math.max(...requiredPitchByPair));
20249
20260
  const shiftedXById = /* @__PURE__ */ new Map();