@cardenelabs/cdl 0.47.0 → 0.48.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/CHANGELOG.md +32 -1
- package/dist/index.cjs +59 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +59 -19
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +59 -19
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +59 -19
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/layout/edges.ts +95 -23
package/dist/react.js
CHANGED
|
@@ -8280,33 +8280,73 @@ function placeAvoidingSiblingPaths(args) {
|
|
|
8280
8280
|
}
|
|
8281
8281
|
};
|
|
8282
8282
|
consider([...wants]);
|
|
8283
|
+
const \u62BC\u3059\u91CF = (idx, side, pos) => {
|
|
8284
|
+
let \u8981\u308B = 0;
|
|
8285
|
+
for (const i of idx) {
|
|
8286
|
+
const box = boxes[i];
|
|
8287
|
+
const rect = { x: box.x, y: pos[i] - box.h / 2, w: box.w, h: box.h };
|
|
8288
|
+
for (const probe of probeSegs[i]) {
|
|
8289
|
+
if (measurePathLabelGapSegs(probe.segs, rect) >= CLEARANCE_PATH_LABEL) continue;
|
|
8290
|
+
let lo = Infinity;
|
|
8291
|
+
let hi = -Infinity;
|
|
8292
|
+
for (const seg of probe.segs) {
|
|
8293
|
+
const c = clipY(seg, box.x, box.x + box.w);
|
|
8294
|
+
if (!c) continue;
|
|
8295
|
+
lo = Math.min(lo, c.lo);
|
|
8296
|
+
hi = Math.max(hi, c.hi);
|
|
8297
|
+
}
|
|
8298
|
+
if (lo > hi) continue;
|
|
8299
|
+
const \u884C\u304D\u5148 = side === "above" ? lo - box.h / 2 - CLEARANCE_PATH_LABEL : hi + box.h / 2 + CLEARANCE_PATH_LABEL;
|
|
8300
|
+
\u8981\u308B = Math.max(\u8981\u308B, side === "above" ? pos[i] - \u884C\u304D\u5148 : \u884C\u304D\u5148 - pos[i]);
|
|
8301
|
+
}
|
|
8302
|
+
}
|
|
8303
|
+
return Math.max(0, \u8981\u308B);
|
|
8304
|
+
};
|
|
8283
8305
|
if (bands.some((b) => b !== null)) {
|
|
8284
8306
|
for (let split = 0; split <= order.length; split++) {
|
|
8285
8307
|
const above = order.slice(0, split);
|
|
8286
8308
|
const below = order.slice(split);
|
|
8287
|
-
const
|
|
8288
|
-
|
|
8289
|
-
[above, "above"],
|
|
8290
|
-
[below, "below"]
|
|
8291
|
-
]) {
|
|
8292
|
-
if (idx.length === 0) continue;
|
|
8293
|
-
const ys = spread(idx);
|
|
8294
|
-
let shift = 0;
|
|
8295
|
-
for (let k = 0; k < idx.length; k++) {
|
|
8296
|
-
const band = bands[idx[k]];
|
|
8297
|
-
if (!band) continue;
|
|
8298
|
-
shift = side === "above" ? Math.min(shift, band.lo - ys[k]) : Math.max(shift, band.hi - ys[k]);
|
|
8299
|
-
}
|
|
8300
|
-
for (let k = 0; k < idx.length; k++) out[idx[k]] = ys[k] + shift;
|
|
8301
|
-
}
|
|
8302
|
-
if (above.length > 0 && below.length > 0) {
|
|
8309
|
+
const \u9593\u3092\u7A7A\u3051\u308B = (out) => {
|
|
8310
|
+
if (above.length === 0 || below.length === 0) return;
|
|
8303
8311
|
const lastIdx = above[above.length - 1];
|
|
8304
8312
|
const firstIdx = below[0];
|
|
8305
8313
|
const need = (sizes[lastIdx] + sizes[firstIdx]) / 2 + CLEARANCE_LABEL_LABEL;
|
|
8306
8314
|
const deficit = need - (out[firstIdx] - out[lastIdx]);
|
|
8307
|
-
if (deficit > 0) for (const i of below) out[i]
|
|
8308
|
-
}
|
|
8309
|
-
|
|
8315
|
+
if (deficit > 0) for (const i of below) out[i] = out[i] + deficit;
|
|
8316
|
+
};
|
|
8317
|
+
const \u5E2F\u3092\u8D8A\u3048\u308B = () => {
|
|
8318
|
+
const out = new Array(members.length);
|
|
8319
|
+
for (const [idx, side] of [
|
|
8320
|
+
[above, "above"],
|
|
8321
|
+
[below, "below"]
|
|
8322
|
+
]) {
|
|
8323
|
+
if (idx.length === 0) continue;
|
|
8324
|
+
const ys = spread(idx);
|
|
8325
|
+
let shift = 0;
|
|
8326
|
+
for (let k = 0; k < idx.length; k++) {
|
|
8327
|
+
const band = bands[idx[k]];
|
|
8328
|
+
if (!band) continue;
|
|
8329
|
+
shift = side === "above" ? Math.min(shift, band.lo - ys[k]) : Math.max(shift, band.hi - ys[k]);
|
|
8330
|
+
}
|
|
8331
|
+
for (let k = 0; k < idx.length; k++) out[idx[k]] = ys[k] + shift;
|
|
8332
|
+
}
|
|
8333
|
+
\u9593\u3092\u7A7A\u3051\u308B(out);
|
|
8334
|
+
return out;
|
|
8335
|
+
};
|
|
8336
|
+
const \u62BC\u3057\u3066\u8D8A\u3048\u308B = () => {
|
|
8337
|
+
const out = \u5E2F\u3092\u8D8A\u3048\u308B();
|
|
8338
|
+
for (let round = 0; round < 4; round += 1) {
|
|
8339
|
+
const a = \u62BC\u3059\u91CF(above, "above", out);
|
|
8340
|
+
const b = \u62BC\u3059\u91CF(below, "below", out);
|
|
8341
|
+
if (a === 0 && b === 0) return out;
|
|
8342
|
+
for (const i of above) out[i] = out[i] - a;
|
|
8343
|
+
for (const i of below) out[i] = out[i] + b;
|
|
8344
|
+
}
|
|
8345
|
+
return \u62BC\u3059\u91CF(above, "above", out) === 0 && \u62BC\u3059\u91CF(below, "below", out) === 0 ? out : null;
|
|
8346
|
+
};
|
|
8347
|
+
consider(\u5E2F\u3092\u8D8A\u3048\u308B());
|
|
8348
|
+
const \u62BC\u3057\u305F = \u62BC\u3057\u3066\u8D8A\u3048\u308B();
|
|
8349
|
+
if (\u62BC\u3057\u305F) consider(\u62BC\u3057\u305F);
|
|
8310
8350
|
}
|
|
8311
8351
|
}
|
|
8312
8352
|
const plain = spread(all);
|