@cardenelabs/cdl 0.30.2 → 0.30.3

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
@@ -20108,11 +20108,66 @@ function \u672B\u5C3E\u3092\u8FBA\u306B\u6CBF\u3063\u3066\u305A\u3089\u3059(e, \
20108
20108
  parts.push(`L ${s.x2} ${s.y2}`);
20109
20109
  }
20110
20110
  const \u6298\u308C1\u306F\u76F4\u524D\u306E\u6298\u308C = Math.abs(\u6298\u308C1.x - last.x1) <= 0.5 && Math.abs(\u6298\u308C1.y - last.y1) <= 0.5;
20111
+ if (\u6298\u308C1\u306F\u76F4\u524D\u306E\u6298\u308C) {
20112
+ const \u6298\u308A\u8FD4\u3055\u306A\u3044 = \u76F4\u524D\u306E\u6298\u308C\u3054\u3068\u305A\u3089\u3059(segs, \u6A2A, d, nodes, e);
20113
+ if (\u6298\u308A\u8FD4\u3055\u306A\u3044) return \u6298\u308A\u8FD4\u3055\u306A\u3044;
20114
+ }
20111
20115
  if (!\u6298\u308C1\u306F\u76F4\u524D\u306E\u6298\u308C) parts.push(`L ${round1(\u6298\u308C1.x)} ${round1(\u6298\u308C1.y)}`);
20112
20116
  parts.push(`L ${round1(\u6298\u308C2.x)} ${round1(\u6298\u308C2.y)}`);
20113
20117
  parts.push(`L ${round1(\u7D42\u70B9.x)} ${round1(\u7D42\u70B9.y)}`);
20114
20118
  return parts.join(" ");
20115
20119
  }
20120
+ function \u76F4\u524D\u306E\u6298\u308C\u3054\u3068\u305A\u3089\u3059(segs, \u6A2A, d, nodes, e) {
20121
+ const \u5E73\u884C\u304B = (s) => \u6A2A ? Math.abs(s.x2 - s.x1) < 0.5 && Math.abs(s.y2 - s.y1) > 0.5 : Math.abs(s.y2 - s.y1) < 0.5 && Math.abs(s.x2 - s.x1) > 0.5;
20122
+ let \u5438\u53CE = -1;
20123
+ for (let i = segs.length - 2; i >= 0; i -= 1) {
20124
+ if (\u5E73\u884C\u304B(segs[i])) {
20125
+ \u5438\u53CE = i;
20126
+ break;
20127
+ }
20128
+ }
20129
+ if (\u5438\u53CE < 0) return null;
20130
+ const \u5143\u306E\u9577\u3055 = \u6A2A ? Math.abs(segs[\u5438\u53CE].y2 - segs[\u5438\u53CE].y1) : Math.abs(segs[\u5438\u53CE].x2 - segs[\u5438\u53CE].x1);
20131
+ const \u5411\u304D = \u6A2A ? Math.sign(segs[\u5438\u53CE].y2 - segs[\u5438\u53CE].y1) : Math.sign(segs[\u5438\u53CE].x2 - segs[\u5438\u53CE].x1);
20132
+ const \u5F8C\u306E\u9577\u3055 = \u5143\u306E\u9577\u3055 + \u5411\u304D * d;
20133
+ if (\u5F8C\u306E\u9577\u3055 < ENDPOINT_FAN_RUNUP) return null;
20134
+ const \u305A\u3089\u3059 = (p) => \u6A2A ? { ...p, y: p.y + d } : { ...p, x: p.x + d };
20135
+ const \u65B0segs = segs.map((s, i) => {
20136
+ if (i <= \u5438\u53CE) return s;
20137
+ return {
20138
+ ...s,
20139
+ x1: \u305A\u3089\u3059({ x: s.x1, y: s.y1 }).x,
20140
+ y1: \u305A\u3089\u3059({ x: s.x1, y: s.y1 }).y,
20141
+ x2: \u305A\u3089\u3059({ x: s.x2, y: s.y2 }).x,
20142
+ y2: \u305A\u3089\u3059({ x: s.x2, y: s.y2 }).y,
20143
+ ...s.ctrl ? { ctrl: s.ctrl.map((c) => \u305A\u3089\u3059(c)) } : {}
20144
+ };
20145
+ });
20146
+ \u65B0segs[\u5438\u53CE] = {
20147
+ ...segs[\u5438\u53CE],
20148
+ x2: \u6A2A ? segs[\u5438\u53CE].x2 : segs[\u5438\u53CE].x2 + d,
20149
+ y2: \u6A2A ? segs[\u5438\u53CE].y2 + d : segs[\u5438\u53CE].y2
20150
+ };
20151
+ if (nodes.some(
20152
+ (n) => n.id !== e.from && n.id !== e.to && segmentsCrossRect(
20153
+ \u65B0segs.slice(\u5438\u53CE).map((s) => ({ x1: s.x1, y1: s.y1, x2: s.x2, y2: s.y2 })),
20154
+ nodeRect(n)
20155
+ )
20156
+ )) {
20157
+ return null;
20158
+ }
20159
+ const head = \u65B0segs[0];
20160
+ const parts = [`M ${round1(head.x1)} ${round1(head.y1)}`];
20161
+ for (const s of \u65B0segs) {
20162
+ if (s.cmd === "Q") {
20163
+ const c = s.ctrl?.[0];
20164
+ parts.push(c ? `Q ${round1(c.x)} ${round1(c.y)}, ${round1(s.x2)} ${round1(s.y2)}` : `L ${round1(s.x2)} ${round1(s.y2)}`);
20165
+ continue;
20166
+ }
20167
+ parts.push(`L ${round1(s.x2)} ${round1(s.y2)}`);
20168
+ }
20169
+ return parts.join(" ");
20170
+ }
20116
20171
 
20117
20172
  // src/layout/lanes.ts
20118
20173
  var LANE_POSITION_EPSILON = 1e-9;