@knowvah/dot-engine 1.2.4 → 1.2.6
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/README.md +15 -0
- package/dist/common/graph-init.d.ts.map +1 -1
- package/dist/common/splines-clip.d.ts +8 -0
- package/dist/common/splines-clip.d.ts.map +1 -1
- package/dist/common/splines-routespl.d.ts +4 -0
- package/dist/common/splines-routespl.d.ts.map +1 -1
- package/dist/index.js +55 -1
- package/dist/index.js.map +2 -2
- package/dist/render.js +55 -1
- package/dist/render.js.map +2 -2
- package/package.json +2 -2
- package/src/common/graph-init.ts +14 -9
- package/src/common/splines-clip.ts +25 -0
- package/src/common/splines-routespl.ts +66 -0
package/dist/render.js
CHANGED
|
@@ -16513,10 +16513,12 @@ function parseRatioKind(g) {
|
|
|
16513
16513
|
}
|
|
16514
16514
|
function parseRatioDrawing(g) {
|
|
16515
16515
|
const kind = parseRatioKind(g);
|
|
16516
|
-
if (kind !== "compress" && kind !== "fill") return;
|
|
16516
|
+
if (kind !== "compress" && kind !== "fill" && kind !== "value") return;
|
|
16517
16517
|
const sz = parseSizePoints(g.attrs.get("size"));
|
|
16518
16518
|
g.info.drawing = makeDrawing({
|
|
16519
16519
|
ratioKind: kind,
|
|
16520
|
+
// C: GD_drawing(g)->ratio = atof(p), set only for R_VALUE (setRatio).
|
|
16521
|
+
ratio: kind === "value" ? Number.parseFloat(g.attrs.get("ratio")) : 0,
|
|
16520
16522
|
size: sz ? { x: sz.x, y: sz.y } : { x: 0, y: 0 },
|
|
16521
16523
|
filled: sz?.filled ?? false
|
|
16522
16524
|
});
|
|
@@ -20101,7 +20103,23 @@ function clipAndInstall(fe, hn, ps, pn, info) {
|
|
|
20101
20103
|
};
|
|
20102
20104
|
SplineClipHelper.arrowClip(fe, hn, ps, bounds, newspl, info);
|
|
20103
20105
|
SplineClipHelper.copyToBezier(newspl, ps, bounds.start, bounds.end, g.info.bb);
|
|
20106
|
+
if (clipDump) {
|
|
20107
|
+
let cur = fe;
|
|
20108
|
+
while (cur.info.to_orig != null && cur.info.edge_type !== 0) cur = cur.info.to_orig;
|
|
20109
|
+
clipDump("S5_CLIP", cur.tail.name, cur.head.name, {
|
|
20110
|
+
inputPn: pn,
|
|
20111
|
+
bounds: { start: bounds.start, end: bounds.end },
|
|
20112
|
+
sflag: newspl.sflag,
|
|
20113
|
+
eflag: newspl.eflag,
|
|
20114
|
+
sp: { ...newspl.sp },
|
|
20115
|
+
ep: { ...newspl.ep },
|
|
20116
|
+
size: newspl.size,
|
|
20117
|
+
// emit reads bz.size, not list.length (memory: bezier-emit-size-not-length)
|
|
20118
|
+
list: newspl.list.slice(0, newspl.size).map((p) => ({ ...p }))
|
|
20119
|
+
});
|
|
20120
|
+
}
|
|
20104
20121
|
}
|
|
20122
|
+
var clipDump = null;
|
|
20105
20123
|
|
|
20106
20124
|
// src/common/splines-selfedge.ts
|
|
20107
20125
|
var SIDE_VERTICES = [12, 4, 6, 2, 3, 1, 9, 8];
|
|
@@ -26495,6 +26513,19 @@ function obsPath(conf, p0, poly0, p1, poly1) {
|
|
|
26495
26513
|
}
|
|
26496
26514
|
|
|
26497
26515
|
// src/common/splines-routespl.ts
|
|
26516
|
+
var routeDump = null;
|
|
26517
|
+
function dumpIsVirtual(e) {
|
|
26518
|
+
return (e.info?.edge_type ?? 0) !== 0;
|
|
26519
|
+
}
|
|
26520
|
+
function dumpEdgeNames(pp) {
|
|
26521
|
+
let e = pp.data;
|
|
26522
|
+
while (e !== null && dumpIsVirtual(e)) e = e.info?.to_orig ?? null;
|
|
26523
|
+
if (e === null) return ["?", "?"];
|
|
26524
|
+
return [e.tail?.name ?? "?", e.head?.name ?? "?"];
|
|
26525
|
+
}
|
|
26526
|
+
function emitDump(stage, names, mk) {
|
|
26527
|
+
if (routeDump !== null && names !== null) routeDump(stage, names[0], names[1], mk());
|
|
26528
|
+
}
|
|
26498
26529
|
function overlap(i0, i1, j0, j1) {
|
|
26499
26530
|
if (i1 <= j0 || i0 >= j1) return 0;
|
|
26500
26531
|
if (i0 <= j0 && i1 >= j1) return i1 - i0;
|
|
@@ -26746,8 +26777,21 @@ function runLimitLoop(boxes, boxn, ps, initLlx, initUrx) {
|
|
|
26746
26777
|
}
|
|
26747
26778
|
function routeSplinesInternal(pp, polyline) {
|
|
26748
26779
|
const boxes = pp.boxes;
|
|
26780
|
+
const dumpNames = routeDump ? dumpEdgeNames(pp) : null;
|
|
26781
|
+
emitDump("S1_INPUT", dumpNames, () => ({
|
|
26782
|
+
nbox: pp.nbox,
|
|
26783
|
+
boxes: pp.boxes.slice(0, pp.nbox).map((b) => ({ ll: { ...b.ll }, ur: { ...b.ur } })),
|
|
26784
|
+
start: { p: { ...pp.start.p }, theta: pp.start.theta, constrained: pp.start.constrained },
|
|
26785
|
+
end: { p: { ...pp.end.p }, theta: pp.end.theta, constrained: pp.end.constrained }
|
|
26786
|
+
}));
|
|
26749
26787
|
if (checkPath(pp.nbox, boxes, pp)) return null;
|
|
26750
26788
|
const effectiveBoxn = pp.nbox;
|
|
26789
|
+
emitDump("S2_CHECKED", dumpNames, () => ({
|
|
26790
|
+
nbox: effectiveBoxn,
|
|
26791
|
+
boxes: boxes.slice(0, effectiveBoxn).map((b) => ({ ll: { ...b.ll }, ur: { ...b.ur } })),
|
|
26792
|
+
start: { p: { ...pp.start.p } },
|
|
26793
|
+
end: { p: { ...pp.end.p } }
|
|
26794
|
+
}));
|
|
26751
26795
|
let flip = false;
|
|
26752
26796
|
if (effectiveBoxn > 1 && boxes[0].ll.y > boxes[1].ll.y) {
|
|
26753
26797
|
flip = true;
|
|
@@ -26775,6 +26819,11 @@ function routeSplinesInternal(pp, polyline) {
|
|
|
26775
26819
|
console.warn("in routesplines, Pshortestpath failed");
|
|
26776
26820
|
return null;
|
|
26777
26821
|
}
|
|
26822
|
+
emitDump("S3_POLY", dumpNames, () => ({
|
|
26823
|
+
poly: polypoints.map((p) => ({ ...p })),
|
|
26824
|
+
eps: [{ ...eps[0] }, { ...eps[1] }],
|
|
26825
|
+
pl: pl.map((p) => ({ ...p }))
|
|
26826
|
+
}));
|
|
26778
26827
|
let ps;
|
|
26779
26828
|
if (polyline) {
|
|
26780
26829
|
ps = makePolyline(pl);
|
|
@@ -26784,6 +26833,11 @@ function routeSplinesInternal(pp, polyline) {
|
|
|
26784
26833
|
ps = routeSpline(edges, pl, evs);
|
|
26785
26834
|
if (ps.length === 0) return null;
|
|
26786
26835
|
}
|
|
26836
|
+
emitDump("S4_SPL", dumpNames, () => ({
|
|
26837
|
+
polyline,
|
|
26838
|
+
evs: polyline ? void 0 : buildConstraintVectors(pp).map((v) => ({ ...v })),
|
|
26839
|
+
ps: ps.map((p) => ({ ...p }))
|
|
26840
|
+
}));
|
|
26787
26841
|
if (isTriviallyBounded(ps)) {
|
|
26788
26842
|
applyTrivialBounds(boxes, effectiveBoxn, ps);
|
|
26789
26843
|
return ps;
|