@knowvah/dot-engine 2.12.0 → 2.12.2
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/api/builder.d.ts +7 -1
- package/dist/api/builder.d.ts.map +1 -1
- package/dist/api.js +14 -7
- package/dist/api.js.map +2 -2
- package/dist/common/edge-in-box.d.ts +6 -20
- package/dist/common/edge-in-box.d.ts.map +1 -1
- package/dist/common/edge-label-init.d.ts +26 -1
- package/dist/common/edge-label-init.d.ts.map +1 -1
- package/dist/common/emit-bb.d.ts +36 -0
- package/dist/common/emit-bb.d.ts.map +1 -0
- package/dist/common/nodeinit.d.ts +16 -2
- package/dist/common/nodeinit.d.ts.map +1 -1
- package/dist/common/splines-path-begin.d.ts.map +1 -1
- package/dist/common/splines-path-end.d.ts.map +1 -1
- package/dist/gvc/__fixtures__/subg-renders/subg-renders.d.ts +10 -0
- package/dist/gvc/__fixtures__/subg-renders/subg-renders.d.ts.map +1 -0
- package/dist/gvc/context.d.ts +8 -0
- package/dist/gvc/context.d.ts.map +1 -1
- package/dist/gvc/device.d.ts.map +1 -1
- package/dist/gvc/emit-gates.d.ts +5 -10
- package/dist/gvc/emit-gates.d.ts.map +1 -1
- package/dist/gvc/emit-xdot.d.ts +10 -0
- package/dist/gvc/emit-xdot.d.ts.map +1 -1
- package/dist/gvc/job.d.ts +5 -2
- package/dist/gvc/job.d.ts.map +1 -1
- package/dist/gvc/viewport.d.ts +10 -5
- package/dist/gvc/viewport.d.ts.map +1 -1
- package/dist/index.js +7617 -7334
- package/dist/index.js.map +4 -4
- package/dist/layout/dot/decomp.d.ts.map +1 -1
- package/dist/layout/dot/edge-route.d.ts +10 -11
- package/dist/layout/dot/edge-route.d.ts.map +1 -1
- package/dist/layout/dot/fastgr.d.ts +5 -3
- package/dist/layout/dot/fastgr.d.ts.map +1 -1
- package/dist/layout/dot/flat-adj-record.d.ts +22 -0
- package/dist/layout/dot/flat-adj-record.d.ts.map +1 -0
- package/dist/layout/dot/init.d.ts +65 -4
- package/dist/layout/dot/init.d.ts.map +1 -1
- package/dist/layout/dot/mincross-build.d.ts +6 -0
- package/dist/layout/dot/mincross-build.d.ts.map +1 -1
- package/dist/layout/dot/position-aux.d.ts +7 -1
- package/dist/layout/dot/position-aux.d.ts.map +1 -1
- package/dist/layout/dot/splines-clone.d.ts +2 -1
- package/dist/layout/dot/splines-clone.d.ts.map +1 -1
- package/dist/layout/dot/splines-flat-labeled.d.ts.map +1 -1
- package/dist/layout/dot/splines-flat.d.ts +18 -0
- package/dist/layout/dot/splines-flat.d.ts.map +1 -1
- package/dist/layout/dot/splines-groups.d.ts.map +1 -1
- package/dist/layout/dot/splines.d.ts +5 -3
- package/dist/layout/dot/splines.d.ts.map +1 -1
- package/dist/layout/fdp/ports.d.ts.map +1 -1
- package/dist/layout/neato/conjgrad-mkernel.d.ts.map +1 -1
- package/dist/layout/neato/fdp-adjust.d.ts.map +1 -1
- package/dist/layout/neato/sgd.d.ts.map +1 -1
- package/dist/layout/sfdp/spring-electrical.d.ts.map +1 -1
- package/dist/model/cgraph-ops.d.ts +10 -2
- package/dist/model/cgraph-ops.d.ts.map +1 -1
- package/dist/model/edge.d.ts +7 -2
- package/dist/model/edge.d.ts.map +1 -1
- package/dist/model/edgeInfo.d.ts +17 -2
- package/dist/model/edgeInfo.d.ts.map +1 -1
- package/dist/model/graph.d.ts +4 -3
- package/dist/model/graph.d.ts.map +1 -1
- package/dist/model/lazy-attrs.d.ts.map +1 -1
- package/dist/parser/builder.d.ts.map +1 -1
- package/dist/render/dot/agwrite-linelength.d.ts +25 -0
- package/dist/render/dot/agwrite-linelength.d.ts.map +1 -0
- package/dist/render/dot/agwrite.d.ts +9 -8
- package/dist/render/dot/agwrite.d.ts.map +1 -1
- package/dist/render/dot/attrs.d.ts +15 -4
- package/dist/render/dot/attrs.d.ts.map +1 -1
- package/dist/render/dot/write-back.d.ts +24 -0
- package/dist/render/dot/write-back.d.ts.map +1 -1
- package/dist/render/dot/xdot-ops.d.ts +20 -29
- package/dist/render/dot/xdot-ops.d.ts.map +1 -1
- package/dist/render/dot.d.ts +5 -4
- package/dist/render/dot.d.ts.map +1 -1
- package/dist/render/json-cluster-edge.d.ts +35 -0
- package/dist/render/json-cluster-edge.d.ts.map +1 -0
- package/dist/render/json-nonfinite.d.ts +17 -0
- package/dist/render/json-nonfinite.d.ts.map +1 -0
- package/dist/render/json.d.ts +4 -0
- package/dist/render/json.d.ts.map +1 -1
- package/dist/render/map.d.ts +3 -0
- package/dist/render/map.d.ts.map +1 -1
- package/dist/render/svg-graph.d.ts.map +1 -1
- package/dist/render/svg-id.d.ts +10 -1
- package/dist/render/svg-id.d.ts.map +1 -1
- package/dist/render/svg.d.ts +3 -1
- package/dist/render/svg.d.ts.map +1 -1
- package/dist/render.js +7657 -7374
- package/dist/render.js.map +4 -4
- package/dist/util/bsd-qsort.d.ts.map +1 -1
- package/dist/util/printf-round.d.ts.map +1 -1
- package/dist/xdot/parse.d.ts.map +1 -1
- package/dist/xdot/strtod.d.ts +23 -0
- package/dist/xdot/strtod.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/api/builder.ts +8 -2
- package/src/common/edge-in-box.ts +9 -24
- package/src/common/edge-label-init.ts +43 -17
- package/src/common/emit-bb.ts +128 -0
- package/src/common/nodeinit.ts +28 -8
- package/src/common/splines-path-begin.ts +4 -3
- package/src/common/splines-path-end.ts +4 -3
- package/src/gvc/__fixtures__/rerender/nestedclust.dot.dot.nofree.1 +45 -0
- package/src/gvc/__fixtures__/rerender/nestedclust.dot.dot.nofree.2 +45 -0
- package/src/gvc/__fixtures__/rerender/nestedclust.dot.dot.nofree.3 +45 -0
- package/src/gvc/__fixtures__/rerender/nestedclust.dot.xdot.nofree.1 +74 -0
- package/src/gvc/__fixtures__/rerender/nestedclust.dot.xdot.nofree.2 +74 -0
- package/src/gvc/__fixtures__/rerender/nestedclust.dot.xdot.nofree.3 +76 -0
- package/src/gvc/__fixtures__/rerender/nestedclust.gv +4 -0
- package/src/gvc/__fixtures__/rerender/regen.sh +5 -0
- package/src/gvc/__fixtures__/subg-renders/subg-renders.ts +48 -0
- package/src/gvc/context.ts +8 -0
- package/src/gvc/device.ts +28 -29
- package/src/gvc/emit-gates.ts +7 -16
- package/src/gvc/emit-xdot.ts +10 -12
- package/src/gvc/job.ts +5 -2
- package/src/gvc/viewport.ts +13 -7
- package/src/layout/dot/__fixtures__/flat-adj-aux-syms.native-16.1.json +1210 -0
- package/src/layout/dot/decomp.ts +23 -2
- package/src/layout/dot/edge-route.ts +52 -86
- package/src/layout/dot/fastgr.ts +9 -3
- package/src/layout/dot/flat-adj-record.ts +68 -0
- package/src/layout/dot/init.ts +84 -13
- package/src/layout/dot/mincross-build.ts +14 -1
- package/src/layout/dot/position-aux.ts +10 -3
- package/src/layout/dot/splines-clone.ts +8 -2
- package/src/layout/dot/splines-flat-labeled.ts +3 -2
- package/src/layout/dot/splines-flat.ts +11 -21
- package/src/layout/dot/splines-groups.ts +7 -5
- package/src/layout/dot/splines-route.ts +2 -2
- package/src/layout/dot/splines.ts +8 -8
- package/src/layout/fdp/ports.ts +6 -2
- package/src/layout/neato/conjgrad-mkernel.ts +6 -2
- package/src/layout/neato/conjgrad.ts +2 -2
- package/src/layout/neato/fdp-adjust.ts +1 -16
- package/src/layout/neato/sgd.ts +2 -1
- package/src/layout/sfdp/spring-electrical.ts +5 -3
- package/src/model/cgraph-ops.ts +4 -3
- package/src/model/edge.ts +11 -4
- package/src/model/edgeInfo.ts +18 -2
- package/src/model/graph.ts +4 -3
- package/src/model/lazy-attrs.ts +3 -1
- package/src/parser/builder.ts +12 -3
- package/src/render/dot/agwrite-linelength.ts +58 -0
- package/src/render/dot/agwrite.ts +23 -16
- package/src/render/dot/attrs.ts +45 -8
- package/src/render/dot/write-back.ts +48 -3
- package/src/render/dot/xdot-ops.ts +26 -57
- package/src/render/dot.ts +16 -20
- package/src/render/json-cluster-edge.ts +87 -0
- package/src/render/json-nonfinite.ts +51 -0
- package/src/render/json.ts +36 -42
- package/src/render/map.ts +6 -7
- package/src/render/svg-graph.ts +9 -8
- package/src/render/svg-id.ts +11 -2
- package/src/render/svg.ts +7 -4
- package/src/util/bsd-qsort.ts +2 -1
- package/src/util/printf-round.ts +16 -10
- package/src/xdot/parse.ts +9 -19
- package/src/xdot/strtod.ts +167 -0
- package/dist/layout/dot/edge-order.d.ts +0 -27
- package/dist/layout/dot/edge-order.d.ts.map +0 -1
- package/src/layout/dot/edge-order.ts +0 -62
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bsd-qsort.d.ts","sourceRoot":"","sources":["../../src/util/bsd-qsort.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bsd-qsort.d.ts","sourceRoot":"","sources":["../../src/util/bsd-qsort.ts"],"names":[],"mappings":"AAgLA;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,CAQ9F;AAyCD;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,GAAG,CAAC,EAAE,CAOrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printf-round.d.ts","sourceRoot":"","sources":["../../src/util/printf-round.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;GAqBG;
|
|
1
|
+
{"version":3,"file":"printf-round.d.ts","sourceRoot":"","sources":["../../src/util/printf-round.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAuEH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAkB/D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAmCxD"}
|
package/dist/xdot/parse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/xdot/parse.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,IAAI,EAAU,QAAQ,EAAE,YAAY,EACf,SAAS,EACC,WAAW,EAC3C,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/xdot/parse.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,IAAI,EAAU,QAAQ,EAAE,YAAY,EACf,SAAS,EACC,WAAW,EAC3C,MAAM,YAAY,CAAC;AAOpB,KAAK,EAAE,CAAC,CAAC,IAAI;IAAE,GAAG,EAAE,CAAC,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC;AAoU5C,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAyC;AACxG,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,CAA6C;AACpH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,CAA2C;AAC1G,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,CAAC,SAAS,CAAC,CAAgD;AACvH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAE5G;AACD,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAE1F;AACD,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAoC;AACrF,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAyC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The number scan C's xdot parser gets from libc strtod. parseReal, parseRect
|
|
3
|
+
* and parsePolyline all read their doubles with strtod, so an xdot string may
|
|
4
|
+
* hold anything strtod accepts: a decimal, a hexadecimal float, `inf` or
|
|
5
|
+
* `infinity`, and `nan` or `nan(...)`. The grammar is the oracle platform's
|
|
6
|
+
* (macOS libc), which takes any characters between `nan(` and the first `)`.
|
|
7
|
+
* @see lib/xdot/xdot.c:parseReal
|
|
8
|
+
*/
|
|
9
|
+
/** A scanned number and the offset just past it, or null when none starts here. */
|
|
10
|
+
export type Scan = {
|
|
11
|
+
val: number;
|
|
12
|
+
pos: number;
|
|
13
|
+
} | null;
|
|
14
|
+
/** @see lib/util/gv_ctype.h:gv_isspace */
|
|
15
|
+
export declare function isSpace(c: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* strtod(s + pos, &end): skips whitespace, takes an optional sign, then the
|
|
18
|
+
* longest number strtod accepts. Null when no conversion is possible, which
|
|
19
|
+
* is C's `end == s`.
|
|
20
|
+
* @see lib/xdot/xdot.c:parseReal
|
|
21
|
+
*/
|
|
22
|
+
export declare function scanStrtod(s: string, pos: number): Scan;
|
|
23
|
+
//# sourceMappingURL=strtod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strtod.d.ts","sourceRoot":"","sources":["../../src/xdot/strtod.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,mFAAmF;AACnF,MAAM,MAAM,IAAI,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC;AAgBvD,0CAA0C;AAC1C,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAE1C;AA2HD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAOvD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knowvah/dot-engine",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.2",
|
|
4
4
|
"description": "Faithful TypeScript port of Graphviz (dot, neato, fdp, sfdp, circo, twopi, osage, patchwork) — no C: no native binary, no WASM. Oracle-verified against the C implementation, runs in the browser.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphviz",
|
package/src/api/builder.ts
CHANGED
|
@@ -26,6 +26,8 @@ import { HTML_STRING_MARK } from '../common/html-string.js';
|
|
|
26
26
|
export interface CreateGraphOptions {
|
|
27
27
|
directed?: boolean;
|
|
28
28
|
strict?: boolean;
|
|
29
|
+
/** The graph's name. Omitted: the graph is anonymous, as `agopen(NULL)` is
|
|
30
|
+
* (written `digraph {`). An explicit `''` is a name (written `digraph "" {`). */
|
|
29
31
|
name?: string;
|
|
30
32
|
}
|
|
31
33
|
|
|
@@ -331,15 +333,19 @@ function resolveKind(opts: CreateGraphOptions | undefined): GraphKind {
|
|
|
331
333
|
* Create a new programmatic graph builder.
|
|
332
334
|
*
|
|
333
335
|
* The builder's `.graph` is a fresh Graph ready for handoff to layout/render.
|
|
334
|
-
* Defaults: directed=true, strict=false, name
|
|
336
|
+
* Defaults: directed=true, strict=false, no name. A graph created without a
|
|
337
|
+
* `name` is anonymous, as `agopen(NULL)` is: `graph.name` reads `''` and dot
|
|
338
|
+
* output starts `digraph {`. An explicit `name: ''` is a name, as `agopen("")`
|
|
339
|
+
* is, and prints `digraph "" {`.
|
|
335
340
|
*
|
|
336
341
|
* @throws TypeError `ERR_INVALID_ARG_TYPE` if `opts` or one of its fields has
|
|
337
342
|
* the wrong type. Builder and handle methods throw the same for wrong
|
|
338
343
|
* argument types, and `InternalError` if node/subgraph creation fails.
|
|
339
344
|
* @see lib/cgraph/graph.c:agopen
|
|
345
|
+
* @see lib/cgraph/id.c:agmapnametoid
|
|
340
346
|
*/
|
|
341
347
|
export function createGraph(opts?: CreateGraphOptions): GvGraphBuilder {
|
|
342
348
|
requireGraphOptions(opts);
|
|
343
|
-
const g = new Graph(opts?.name ?? '', resolveKind(opts));
|
|
349
|
+
const g = new Graph(opts?.name ?? '', resolveKind(opts), opts?.name === undefined);
|
|
344
350
|
return new GraphBuilder(g, g);
|
|
345
351
|
}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* emit_edge's edge_in_box gate, shared by the device walk (edge comments) and
|
|
5
|
-
* the SVG / xdot renderers (edge group and draw ops).
|
|
6
|
-
* render/svg.ts unchanged.
|
|
5
|
+
* the SVG / xdot renderers (edge group and draw ops).
|
|
7
6
|
*
|
|
8
7
|
* @see lib/common/emit.c:edge_in_box, lib/common/utils.c:overlap_label
|
|
9
8
|
*/
|
|
@@ -26,29 +25,15 @@ function overlapLabel(lp: TextlabelT, b: Box): boolean {
|
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* The only piece that can legitimately fall OUTSIDE the clip on this corpus is a
|
|
35
|
-
* degenerate labeled-flat label: it is spline-less, so map_edge leaves it at its
|
|
36
|
-
* internal (un-normalized) x-frame position while the clip is the final frame.
|
|
37
|
-
* The `overlapLabel` test on the main label reproduces C's draw-iff-overlap for
|
|
38
|
-
* exactly that case — on-canvas (2368) → drawn; off-canvas (2368_1, negative
|
|
39
|
-
* un-normalized x) → suppressed. A present spline always lies within the clip
|
|
40
|
-
* (GD_bb contains it), and head/tail/xlabels are positioned at on-canvas
|
|
41
|
-
* endpoints, so those keep their existing unconditional triggers — adding an
|
|
42
|
-
* overlap test there only risks suppressing legitimately-drawn content (it
|
|
43
|
-
* regressed neato/circo edges whose spl.bb is computed differently). The `set`
|
|
44
|
-
* guard on the main label is kept: the port retains an unplaced (`pos=0,0`,
|
|
45
|
-
* `set=false`) label on merged back-edges where C has none.
|
|
46
|
-
* @see lib/common/emit.c:edge_in_box, lib/common/utils.c:overlap_label
|
|
28
|
+
* `edge_in_box`: whether any piece of the edge overlaps the page clip — the
|
|
29
|
+
* spline's box (`spl->bb`, which init_bb computes before every render; see
|
|
30
|
+
* emit-bb.ts), the label, or a placed xlabel. emit_edge draws nothing, not even
|
|
31
|
+
* the edge's group, when this fails. Head and tail labels are not tested.
|
|
32
|
+
* @see lib/common/emit.c:2686 edge_in_box, lib/common/utils.c:overlap_label
|
|
47
33
|
*/
|
|
48
34
|
export function edgeHasDrawableContent(e: Edge, clip: Box): boolean {
|
|
49
35
|
const i = e.info;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|| i.head_label !== undefined || i.tail_label !== undefined;
|
|
36
|
+
if (i.spl !== undefined && boxOverlap(i.spl.bb, clip)) return true;
|
|
37
|
+
if (i.label !== undefined && overlapLabel(i.label, clip)) return true;
|
|
38
|
+
return i.xlabel !== undefined && i.xlabel.set && overlapLabel(i.xlabel, clip);
|
|
54
39
|
}
|
|
@@ -220,12 +220,32 @@ function applyTailLabel(e: Edge, g: Graph, lfi: FontInfo, measurer: TextMeasurer
|
|
|
220
220
|
// @see lib/common/utils.c:509-545
|
|
221
221
|
// ---------------------------------------------------------------------------
|
|
222
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Which of common_init_edge's guarded label symbols are bound. C tests each
|
|
225
|
+
* global before reading it (`E_xlabel && (str = agxget(e, E_xlabel)) && str[0]`),
|
|
226
|
+
* and make_flat_adj_edges' setState nulls these three for the aux layout, so an
|
|
227
|
+
* aux edge's copied `xlabel`, `headlabel` and `taillabel` are never read: no
|
|
228
|
+
* label is made and no GD_has_labels bit is set. E_label is rebound from the
|
|
229
|
+
* aux graph instead, so it has no entry here.
|
|
230
|
+
* @see lib/common/utils.c:common_init_edge (525, 533, 539)
|
|
231
|
+
* @see lib/dotgen/dotsplines.c:setState
|
|
232
|
+
*/
|
|
233
|
+
export interface EdgeLabelSyms {
|
|
234
|
+
readonly headlabel: boolean;
|
|
235
|
+
readonly taillabel: boolean;
|
|
236
|
+
readonly xlabel: boolean;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** Every symbol bound, as graph_init leaves them. @see lib/common/input.c:graph_init */
|
|
240
|
+
export const BOUND_EDGE_LABEL_SYMS: EdgeLabelSyms = { headlabel: true, taillabel: true, xlabel: true };
|
|
241
|
+
|
|
223
242
|
/**
|
|
224
243
|
* Apply label and xlabel with lazy fi init mirroring C's NULL-guard pattern.
|
|
225
|
-
* fi is initialized at most once and reused for xlabel.
|
|
244
|
+
* fi is initialized at most once and reused for xlabel. An unbound E_xlabel
|
|
245
|
+
* fails C's guard before the attribute is read.
|
|
226
246
|
* @see lib/common/utils.c:common_init_edge (lines 515-531)
|
|
227
247
|
*/
|
|
228
|
-
function applyMainLabels(e: Edge, g: Graph, measurer: TextMeasurer): void {
|
|
248
|
+
function applyMainLabels(e: Edge, g: Graph, measurer: TextMeasurer, syms: EdgeLabelSyms): void {
|
|
229
249
|
// C: fi.fontname = NULL; init on first need, reuse for xlabel.
|
|
230
250
|
let fi: FontInfo | null = null;
|
|
231
251
|
const labelStr = e.attrs.get('label');
|
|
@@ -233,29 +253,25 @@ function applyMainLabels(e: Edge, g: Graph, measurer: TextMeasurer): void {
|
|
|
233
253
|
fi = initFontEdgeAttr(e);
|
|
234
254
|
applyLabel(e, g, fi, measurer);
|
|
235
255
|
}
|
|
236
|
-
|
|
256
|
+
// utils.c:525 — E_xlabel && (str = agxget(e, E_xlabel)) && str[0]
|
|
257
|
+
const xlabelStr = syms.xlabel ? e.attrs.get('xlabel') : undefined;
|
|
237
258
|
if (xlabelStr) {
|
|
238
259
|
applyXLabel(e, g, fi ?? initFontEdgeAttr(e), measurer);
|
|
239
260
|
}
|
|
240
261
|
}
|
|
241
262
|
|
|
242
263
|
/**
|
|
243
|
-
* Apply headlabel and taillabel using the labelfont* chain.
|
|
264
|
+
* Apply headlabel and taillabel using the labelfont* chain. An unbound
|
|
265
|
+
* E_headlabel or E_taillabel fails C's guard before the attribute is read.
|
|
244
266
|
* @see lib/common/utils.c:common_init_edge (lines 533-545)
|
|
245
267
|
*/
|
|
246
|
-
function applyEndLabels(e: Edge, g: Graph, measurer: TextMeasurer): void {
|
|
268
|
+
function applyEndLabels(e: Edge, g: Graph, measurer: TextMeasurer, syms: EdgeLabelSyms): void {
|
|
269
|
+
if (!syms.headlabel && !syms.taillabel) return;
|
|
247
270
|
const lfi = getLabelFontInfo(e);
|
|
248
|
-
applyHeadLabel(e, g, lfi, measurer);
|
|
249
|
-
applyTailLabel(e, g, lfi, measurer);
|
|
271
|
+
if (syms.headlabel) applyHeadLabel(e, g, lfi, measurer); // utils.c:533
|
|
272
|
+
if (syms.taillabel) applyTailLabel(e, g, lfi, measurer); // utils.c:539
|
|
250
273
|
}
|
|
251
274
|
|
|
252
|
-
/**
|
|
253
|
-
* Creates label, xlabel, head_label, and tail_label TextlabelT objects on the
|
|
254
|
-
* edge, mirroring common_init_edge in C. C statement order is preserved:
|
|
255
|
-
* label → xlabel → headlabel → taillabel.
|
|
256
|
-
*
|
|
257
|
-
* @see lib/common/utils.c:common_init_edge (lines 509-545)
|
|
258
|
-
*/
|
|
259
275
|
/** Shape portfn: aiming point + slope for a named/compass port. */
|
|
260
276
|
type PortFn = (n: unknown, portname: string, compass: string) => Port;
|
|
261
277
|
|
|
@@ -307,11 +323,21 @@ export function initEdgePorts(e: Edge): void {
|
|
|
307
323
|
if (isClipDisabled(e.attrs.get('headclip'))) e.info.head_port.clip = false;
|
|
308
324
|
}
|
|
309
325
|
|
|
310
|
-
|
|
326
|
+
/**
|
|
327
|
+
* Creates label, xlabel, head_label, and tail_label TextlabelT objects on the
|
|
328
|
+
* edge, mirroring common_init_edge in C. C statement order is preserved:
|
|
329
|
+
* label → xlabel → headlabel → taillabel. `syms` stands for the global symbol
|
|
330
|
+
* state the three guarded reads test (unbound inside make_flat_adj_edges).
|
|
331
|
+
*
|
|
332
|
+
* @see lib/common/utils.c:common_init_edge (lines 509-545)
|
|
333
|
+
*/
|
|
334
|
+
export function initEdgeLabels(
|
|
335
|
+
e: Edge, g: Graph, measurer: TextMeasurer, syms: EdgeLabelSyms = BOUND_EDGE_LABEL_SYMS,
|
|
336
|
+
): void {
|
|
311
337
|
initEdgePorts(e); // port block runs for every edge, before the label short-circuit
|
|
312
338
|
const hasMain = e.attrs.has('label') || e.attrs.has('xlabel');
|
|
313
339
|
const hasEnd = e.attrs.has('headlabel') || e.attrs.has('taillabel');
|
|
314
340
|
if (!hasMain && !hasEnd) return;
|
|
315
|
-
if (hasMain) applyMainLabels(e, g, measurer);
|
|
316
|
-
if (hasEnd) applyEndLabels(e, g, measurer);
|
|
341
|
+
if (hasMain) applyMainLabels(e, g, measurer, syms);
|
|
342
|
+
if (hasEnd) applyEndLabels(e, g, measurer, syms);
|
|
317
343
|
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The bounding boxes gvRenderJobs computes before every render: each node's
|
|
5
|
+
* `ND_bb` and each out-edge's `spl->bb`, which `edge_in_box` tests against the
|
|
6
|
+
* page clip. The node half is not stored: `nodeInBox` derives `ND_bb` from the
|
|
7
|
+
* same fields at the test, and nothing between here and that test moves a node.
|
|
8
|
+
*
|
|
9
|
+
* @see lib/common/emit.c:4076 bezier_bb, :4101 init_splines_bb, :4157 init_bb
|
|
10
|
+
* @see lib/common/arrows.c:1107 arrow_bb
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { Bezier, Box, Point, Spline } from '../model/geom.js';
|
|
14
|
+
import type { Graph } from '../model/graph.js';
|
|
15
|
+
import { buildOutEdgeIndex } from '../model/node.js';
|
|
16
|
+
import { ARROW_LENGTH, EPSILON } from './arrows-constants.js';
|
|
17
|
+
import { libmHypot } from './libm-hypot.js';
|
|
18
|
+
|
|
19
|
+
/** C `fmax`: a NaN operand yields the other operand. */
|
|
20
|
+
function fmax(a: number, b: number): number {
|
|
21
|
+
if (Number.isNaN(a)) return b;
|
|
22
|
+
if (Number.isNaN(b)) return a;
|
|
23
|
+
return a > b ? a : b;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** C `fmin`: a NaN operand yields the other operand. */
|
|
27
|
+
function fmin(a: number, b: number): number {
|
|
28
|
+
if (Number.isNaN(a)) return b;
|
|
29
|
+
if (Number.isNaN(b)) return a;
|
|
30
|
+
return a < b ? a : b;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The box of an arrowhead of length `ARROW_LENGTH * arrowsize` at `p`, aimed
|
|
35
|
+
* along `u - p`: the four corners of the rotated head's bounding square.
|
|
36
|
+
* @see lib/common/arrows.c:1107 arrow_bb
|
|
37
|
+
*/
|
|
38
|
+
export function arrowBb(p: Point, u0: Point, arrowsize: number): Box {
|
|
39
|
+
const u = { x: u0.x - p.x, y: u0.y - p.y };
|
|
40
|
+
// the EPSILONs are to keep this stable as length of u approaches 0.0
|
|
41
|
+
const s = (ARROW_LENGTH * arrowsize) / (libmHypot(u.x, u.y) + EPSILON);
|
|
42
|
+
u.x += u.x >= 0.0 ? EPSILON : -EPSILON;
|
|
43
|
+
u.y += u.y >= 0.0 ? EPSILON : -EPSILON;
|
|
44
|
+
u.x *= s;
|
|
45
|
+
u.y *= s;
|
|
46
|
+
const ux2 = u.x / 2;
|
|
47
|
+
const uy2 = u.y / 2;
|
|
48
|
+
const ax = p.x - uy2;
|
|
49
|
+
const ay = p.y - ux2;
|
|
50
|
+
const bx = p.x + uy2;
|
|
51
|
+
const by = p.y + ux2;
|
|
52
|
+
const cx = ax + u.x;
|
|
53
|
+
const cy = ay + u.y;
|
|
54
|
+
const dx = bx + u.x;
|
|
55
|
+
const dy = by + u.y;
|
|
56
|
+
return {
|
|
57
|
+
ur: { x: fmax(ax, fmax(bx, fmax(cx, dx))), y: fmax(ay, fmax(by, fmax(cy, dy))) },
|
|
58
|
+
ll: { x: fmin(ax, fmin(bx, fmin(cx, dx))), y: fmin(ay, fmin(by, fmin(cy, dy))) },
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** expandbp: grow `bb` to hold `p`. @see lib/common/geom.h:expandbp */
|
|
63
|
+
function expandbp(bb: Box, p: Point): void {
|
|
64
|
+
bb.ll.x = fmin(bb.ll.x, p.x);
|
|
65
|
+
bb.ll.y = fmin(bb.ll.y, p.y);
|
|
66
|
+
bb.ur.x = fmax(bb.ur.x, p.x);
|
|
67
|
+
bb.ur.y = fmax(bb.ur.y, p.y);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** EXPANDBB: grow `bb` to hold `b`. @see lib/common/geom.h:EXPANDBB */
|
|
71
|
+
function expandBb(bb: Box, b: Box): void {
|
|
72
|
+
bb.ll.x = fmin(bb.ll.x, b.ll.x);
|
|
73
|
+
bb.ll.y = fmin(bb.ll.y, b.ll.y);
|
|
74
|
+
bb.ur.x = fmax(bb.ur.x, b.ur.x);
|
|
75
|
+
bb.ur.y = fmax(bb.ur.y, b.ur.y);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A bezier's box: its first point, then per segment the midpoint of the two
|
|
80
|
+
* control points and the segment's end point.
|
|
81
|
+
* @see lib/common/emit.c:4076 bezier_bb
|
|
82
|
+
*/
|
|
83
|
+
export function bezierBb(bz: Bezier): Box {
|
|
84
|
+
const p0 = bz.list[0]!;
|
|
85
|
+
const bb: Box = { ll: { x: p0.x, y: p0.y }, ur: { x: p0.x, y: p0.y } };
|
|
86
|
+
for (let i = 1; i < bz.size;) {
|
|
87
|
+
// take mid-point between two control points for bb calculation
|
|
88
|
+
const p1 = bz.list[i++]!;
|
|
89
|
+
const p2 = bz.list[i++]!;
|
|
90
|
+
expandbp(bb, { x: (p1.x + p2.x) / 2, y: (p1.y + p2.y) / 2 });
|
|
91
|
+
expandbp(bb, bz.list[i++]!);
|
|
92
|
+
}
|
|
93
|
+
return bb;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* `spl->bb`: the union of every bezier's box and, for each flagged end, the
|
|
98
|
+
* box of a unit-size arrowhead there.
|
|
99
|
+
* @see lib/common/emit.c:4101 init_splines_bb
|
|
100
|
+
*/
|
|
101
|
+
export function initSplinesBb(spl: Spline): void {
|
|
102
|
+
let bz = spl.list[0]!;
|
|
103
|
+
const bb = bezierBb(bz);
|
|
104
|
+
for (let i = 0; i < spl.size; i++) {
|
|
105
|
+
if (i > 0) {
|
|
106
|
+
bz = spl.list[i]!;
|
|
107
|
+
expandBb(bb, bezierBb(bz));
|
|
108
|
+
}
|
|
109
|
+
if (bz.sflag) expandBb(bb, arrowBb(bz.sp, bz.list[0]!, 1));
|
|
110
|
+
if (bz.eflag) expandBb(bb, arrowBb(bz.ep, bz.list[bz.size - 1]!, 1));
|
|
111
|
+
}
|
|
112
|
+
spl.bb = bb;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Before each render: `spl->bb` of every out-edge of every node of `g`, the
|
|
117
|
+
* graph being rendered (a subgraph render leaves other edges' boxes alone).
|
|
118
|
+
* @see lib/common/emit.c:4127 init_bb_edge, :4136 init_bb_node, :4157 init_bb
|
|
119
|
+
*/
|
|
120
|
+
export function initBb(g: Graph): void {
|
|
121
|
+
const out = buildOutEdgeIndex(g);
|
|
122
|
+
for (const n of g.nodes.values()) {
|
|
123
|
+
for (const e of out.get(n) ?? []) {
|
|
124
|
+
const spl = e.info.spl;
|
|
125
|
+
if (spl) initSplinesBb(spl);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
package/src/common/nodeinit.ts
CHANGED
|
@@ -160,11 +160,28 @@ export function polySizeParamsFromNode(
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
|
-
*
|
|
163
|
+
* Which of common_init_node's guarded symbols are bound. C tests N_xlabel
|
|
164
|
+
* before reading it (`N_xlabel && (str = agxget(n, N_xlabel)) && str[0]`), and
|
|
165
|
+
* make_flat_adj_edges' setState nulls it for the aux layout, so an aux node's
|
|
166
|
+
* copied `xlabel` is never read.
|
|
167
|
+
* @see lib/common/utils.c:common_init_node (443)
|
|
168
|
+
* @see lib/dotgen/dotsplines.c:setState
|
|
169
|
+
*/
|
|
170
|
+
export interface NodeInitSyms {
|
|
171
|
+
readonly nodeXlabel: boolean;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** N_xlabel bound, as graph_init leaves it. @see lib/common/input.c:graph_init */
|
|
175
|
+
export const BOUND_NODE_INIT_SYMS: NodeInitSyms = { nodeXlabel: true };
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Create ND_xlabel when N_xlabel is bound and the xlabel attr is non-empty,
|
|
179
|
+
* and set NODE_XLABEL.
|
|
164
180
|
* @see lib/common/utils.c:443-447
|
|
165
181
|
* @see lib/common/utils.c:447 — GD_has_labels scoped to agraphof(n) root
|
|
166
182
|
*/
|
|
167
|
-
function initNodeXLabel(n: Node, g: Graph, measurer: TextMeasurer): void {
|
|
183
|
+
function initNodeXLabel(n: Node, g: Graph, measurer: TextMeasurer, syms: NodeInitSyms): void {
|
|
184
|
+
if (!syms.nodeXlabel) return; // utils.c:443 — the `N_xlabel &&` guard
|
|
168
185
|
const str = nodeAttr(n, g, 'xlabel');
|
|
169
186
|
if (!str || str.length === 0) return;
|
|
170
187
|
const font = readFontAttrs(n, g);
|
|
@@ -228,7 +245,7 @@ function initPointSize(n: Node, g: Graph, shape: ShapeDesc & { polygon: PolygonT
|
|
|
228
245
|
* has no polygon descriptor to size against.
|
|
229
246
|
* @see lib/common/utils.c:common_init_node
|
|
230
247
|
*/
|
|
231
|
-
function initNodeFromLabel(n: Node, g: Graph, measurer: TextMeasurer): boolean {
|
|
248
|
+
function initNodeFromLabel(n: Node, g: Graph, measurer: TextMeasurer, syms: NodeInitSyms): boolean {
|
|
232
249
|
const shape = bindShape(nodeAttr(n, g, 'shape') ?? 'ellipse', nodeAttr(n, g, 'shapefile'));
|
|
233
250
|
n.info.shape = shape;
|
|
234
251
|
if (shape.kind === ShapeKind.SH_RECORD) {
|
|
@@ -237,12 +254,12 @@ function initNodeFromLabel(n: Node, g: Graph, measurer: TextMeasurer): boolean {
|
|
|
237
254
|
// only selects make_label's is_record flag and initfn=record_init — it is
|
|
238
255
|
// NOT a reason to skip the xlabel (utils.c:441/443/453).
|
|
239
256
|
recordMakeLabel(n, g, measurer);
|
|
240
|
-
initNodeXLabel(n, g, measurer);
|
|
257
|
+
initNodeXLabel(n, g, measurer, syms);
|
|
241
258
|
recordInit(n, g, measurer); // initfn: sets lw/rw/ht from the field tree
|
|
242
259
|
return true;
|
|
243
260
|
}
|
|
244
261
|
buildNodeLabel(n, g, measurer);
|
|
245
|
-
initNodeXLabel(n, g, measurer);
|
|
262
|
+
initNodeXLabel(n, g, measurer, syms);
|
|
246
263
|
// Layout-time poly_init warnings (once per layout; render-time polyInit is silent).
|
|
247
264
|
if (shape.kind !== ShapeKind.SH_POINT) warnPolyInitImages(n, g);
|
|
248
265
|
const poly = shape.polygon;
|
|
@@ -330,13 +347,16 @@ function initNodeDefaults(n: Node, g: Graph): void {
|
|
|
330
347
|
|
|
331
348
|
/**
|
|
332
349
|
* Initialise per-node geometry: shape-aware, label-driven sizing when a
|
|
333
|
-
* text measurer is available; width/height attr defaults otherwise.
|
|
350
|
+
* text measurer is available; width/height attr defaults otherwise. `syms`
|
|
351
|
+
* stands for the global symbol state common_init_node reads.
|
|
334
352
|
* @see lib/common/utils.c:common_init_node
|
|
335
353
|
* @see lib/common/utils.c:gv_nodesize
|
|
336
354
|
*/
|
|
337
|
-
export function commonInitNode(
|
|
355
|
+
export function commonInitNode(
|
|
356
|
+
n: Node, g: Graph, syms: NodeInitSyms = BOUND_NODE_INIT_SYMS,
|
|
357
|
+
): void {
|
|
338
358
|
const measurer = layoutMeasurer(g);
|
|
339
|
-
if (measurer !== undefined && initNodeFromLabel(n, g, measurer)) return;
|
|
359
|
+
if (measurer !== undefined && initNodeFromLabel(n, g, measurer, syms)) return;
|
|
340
360
|
initNodeDefaults(n, g);
|
|
341
361
|
}
|
|
342
362
|
|
|
@@ -35,9 +35,10 @@ class BeginRegSide {
|
|
|
35
35
|
static topLeft(ctx: BeginCtx): void {
|
|
36
36
|
const { P, n, endp, ranksep } = ctx;
|
|
37
37
|
const b = endp.nb;
|
|
38
|
+
// C: GD_ranksep is int (types.h:335), so /2 truncates
|
|
38
39
|
endp.boxes[0] = {
|
|
39
40
|
ll: { x: b.ll.x - 1, y: P.start.p.y },
|
|
40
|
-
ur: { x: b.ur.x, y: n.info.coord.y + n.info.ht / 2 + ranksep / 2 },
|
|
41
|
+
ur: { x: b.ur.x, y: n.info.coord.y + n.info.ht / 2 + Math.trunc(ranksep / 2) },
|
|
41
42
|
};
|
|
42
43
|
endp.boxes[1] = {
|
|
43
44
|
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 },
|
|
@@ -50,7 +51,7 @@ class BeginRegSide {
|
|
|
50
51
|
const b = endp.nb;
|
|
51
52
|
endp.boxes[0] = {
|
|
52
53
|
ll: { x: b.ll.x, y: P.start.p.y },
|
|
53
|
-
ur: { x: b.ur.x + 1, y: n.info.coord.y + n.info.ht / 2 + ranksep / 2 },
|
|
54
|
+
ur: { x: b.ur.x + 1, y: n.info.coord.y + n.info.ht / 2 + Math.trunc(ranksep / 2) },
|
|
54
55
|
};
|
|
55
56
|
endp.boxes[1] = {
|
|
56
57
|
ll: { x: n.info.coord.x + n.info.rw + (FUDGE - 2), y: n.info.coord.y - n.info.ht / 2 },
|
|
@@ -121,7 +122,7 @@ class BeginFlatSide {
|
|
|
121
122
|
const { P, n, endp, ranksep } = ctx;
|
|
122
123
|
if (endp.sidemask === TOP) {
|
|
123
124
|
endp.boxes[0] = {
|
|
124
|
-
ll: { x: P.start.p.x, y: n.info.coord.y - n.info.ht / 2 - ranksep / 2 },
|
|
125
|
+
ll: { x: P.start.p.x, y: n.info.coord.y - n.info.ht / 2 - Math.trunc(ranksep / 2) },
|
|
125
126
|
ur: { x: b.ur.x + 1, y: n.info.coord.y - n.info.ht / 2 },
|
|
126
127
|
};
|
|
127
128
|
endp.boxes[1] = {
|
|
@@ -45,8 +45,9 @@ class EndRegSide {
|
|
|
45
45
|
const { P, n, e, endp, ranksep } = ctx;
|
|
46
46
|
const b = endp.nb;
|
|
47
47
|
if (P.end.p.x < n.info.coord.x) {
|
|
48
|
+
// C: GD_ranksep is int (types.h:335), so /2 truncates
|
|
48
49
|
endp.boxes[0] = {
|
|
49
|
-
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 - ranksep / 2 },
|
|
50
|
+
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 - Math.trunc(ranksep / 2) },
|
|
50
51
|
ur: { x: b.ur.x, y: P.end.p.y },
|
|
51
52
|
};
|
|
52
53
|
endp.boxes[1] = {
|
|
@@ -55,7 +56,7 @@ class EndRegSide {
|
|
|
55
56
|
};
|
|
56
57
|
} else {
|
|
57
58
|
endp.boxes[0] = {
|
|
58
|
-
ll: { x: b.ll.x, y: n.info.coord.y - n.info.ht / 2 - ranksep / 2 },
|
|
59
|
+
ll: { x: b.ll.x, y: n.info.coord.y - n.info.ht / 2 - Math.trunc(ranksep / 2) },
|
|
59
60
|
ur: { x: b.ur.x + 1, y: P.end.p.y },
|
|
60
61
|
};
|
|
61
62
|
endp.boxes[1] = {
|
|
@@ -121,7 +122,7 @@ class EndFlatSide {
|
|
|
121
122
|
const { P, n, endp, ranksep } = ctx;
|
|
122
123
|
if (endp.sidemask === TOP) {
|
|
123
124
|
endp.boxes[0] = {
|
|
124
|
-
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 - ranksep / 2 },
|
|
125
|
+
ll: { x: b.ll.x - 1, y: n.info.coord.y - n.info.ht / 2 - Math.trunc(ranksep / 2) },
|
|
125
126
|
ur: { x: P.end.p.x, y: n.info.coord.y - n.info.ht / 2 },
|
|
126
127
|
};
|
|
127
128
|
endp.boxes[1] = {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
digraph G {
|
|
2
|
+
graph [bb="0,0,300,220"];
|
|
3
|
+
node [color="#00ff005f",
|
|
4
|
+
fillcolor="#00ff005f",
|
|
5
|
+
label="\N",
|
|
6
|
+
style=filled
|
|
7
|
+
];
|
|
8
|
+
{
|
|
9
|
+
subgraph cluster_ss81 {
|
|
10
|
+
graph [bb="64,8,134,204"];
|
|
11
|
+
a [height=0.5,
|
|
12
|
+
pos="99,178",
|
|
13
|
+
width=0.75];
|
|
14
|
+
b [height=0.5,
|
|
15
|
+
pos="99,106",
|
|
16
|
+
width=0.75];
|
|
17
|
+
a -> b [pos="e,99,124.1 99,159.7 99,152.41 99,143.73 99,135.54"];
|
|
18
|
+
c [height=0.5,
|
|
19
|
+
pos="99,34",
|
|
20
|
+
width=0.75];
|
|
21
|
+
b -> c [pos="e,99,52.104 99,87.697 99,80.407 99,71.726 99,63.536"];
|
|
22
|
+
}
|
|
23
|
+
e [height=0.5,
|
|
24
|
+
pos="27,178",
|
|
25
|
+
width=0.75];
|
|
26
|
+
f [height=0.5,
|
|
27
|
+
pos="27,106",
|
|
28
|
+
width=0.75];
|
|
29
|
+
e -> f [pos="e,27,124.1 27,159.7 27,152.41 27,143.73 27,135.54"];
|
|
30
|
+
}
|
|
31
|
+
{
|
|
32
|
+
subgraph cluster_x {
|
|
33
|
+
graph [bb="142,144,292,212"];
|
|
34
|
+
subgraph cluster_y {
|
|
35
|
+
graph [bb="150,152,220,204"];
|
|
36
|
+
y [height=0.5,
|
|
37
|
+
pos="185,178",
|
|
38
|
+
width=0.75];
|
|
39
|
+
}
|
|
40
|
+
x [height=0.5,
|
|
41
|
+
pos="257,178",
|
|
42
|
+
width=0.75];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
digraph G {
|
|
2
|
+
graph [bb="0,0,300,220"];
|
|
3
|
+
node [color="#00ff005f",
|
|
4
|
+
fillcolor="#00ff005f",
|
|
5
|
+
label="\N",
|
|
6
|
+
style=filled
|
|
7
|
+
];
|
|
8
|
+
{
|
|
9
|
+
subgraph cluster_ss81 {
|
|
10
|
+
graph [bb="64,8,134,204"];
|
|
11
|
+
a [height=0.5,
|
|
12
|
+
pos="0,178",
|
|
13
|
+
width=0.75];
|
|
14
|
+
b [height=0.5,
|
|
15
|
+
pos="0,106",
|
|
16
|
+
width=0.75];
|
|
17
|
+
a -> b [pos="e,99,124.1 99,159.7 99,152.41 99,143.73 99,135.54"];
|
|
18
|
+
c [height=0.5,
|
|
19
|
+
pos="0,34",
|
|
20
|
+
width=0.75];
|
|
21
|
+
b -> c [pos="e,99,52.104 99,87.697 99,80.407 99,71.726 99,63.536"];
|
|
22
|
+
}
|
|
23
|
+
e [height=0.5,
|
|
24
|
+
pos="0,178",
|
|
25
|
+
width=0.75];
|
|
26
|
+
f [height=0.5,
|
|
27
|
+
pos="1,106",
|
|
28
|
+
width=0.75];
|
|
29
|
+
e -> f [pos="e,27,124.1 27,159.7 27,152.41 27,143.73 27,135.54"];
|
|
30
|
+
}
|
|
31
|
+
{
|
|
32
|
+
subgraph cluster_x {
|
|
33
|
+
graph [bb="142,144,292,212"];
|
|
34
|
+
subgraph cluster_y {
|
|
35
|
+
graph [bb="150,152,220,204"];
|
|
36
|
+
y [height=0.5,
|
|
37
|
+
pos="0,178",
|
|
38
|
+
width=0.75];
|
|
39
|
+
}
|
|
40
|
+
x [height=0.5,
|
|
41
|
+
pos="0,178",
|
|
42
|
+
width=0.75];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
digraph G {
|
|
2
|
+
graph [bb="0,0,300,220"];
|
|
3
|
+
node [color="#00ff005f",
|
|
4
|
+
fillcolor="#00ff005f",
|
|
5
|
+
label="\N",
|
|
6
|
+
style=filled
|
|
7
|
+
];
|
|
8
|
+
{
|
|
9
|
+
subgraph cluster_ss81 {
|
|
10
|
+
graph [bb="64,8,134,204"];
|
|
11
|
+
a [height=0.5,
|
|
12
|
+
pos="0,178",
|
|
13
|
+
width=0.75];
|
|
14
|
+
b [height=0.5,
|
|
15
|
+
pos="0,106",
|
|
16
|
+
width=0.75];
|
|
17
|
+
a -> b [pos="e,99,124.1 99,159.7 99,152.41 99,143.73 99,135.54"];
|
|
18
|
+
c [height=0.5,
|
|
19
|
+
pos="0,34",
|
|
20
|
+
width=0.75];
|
|
21
|
+
b -> c [pos="e,99,52.104 99,87.697 99,80.407 99,71.726 99,63.536;e,0,52.104 0,87.697 0,80.407 0,71.726 0,63.536"];
|
|
22
|
+
}
|
|
23
|
+
e [height=0.5,
|
|
24
|
+
pos="0,178",
|
|
25
|
+
width=0.75];
|
|
26
|
+
f [height=0.5,
|
|
27
|
+
pos="0,106",
|
|
28
|
+
width=0.75];
|
|
29
|
+
e -> f [pos="e,27,124.1 27,159.7 27,152.41 27,143.73 27,135.54"];
|
|
30
|
+
}
|
|
31
|
+
{
|
|
32
|
+
subgraph cluster_x {
|
|
33
|
+
graph [bb="142,144,292,212"];
|
|
34
|
+
subgraph cluster_y {
|
|
35
|
+
graph [bb="150,152,220,204"];
|
|
36
|
+
y [height=0.5,
|
|
37
|
+
pos="0,178",
|
|
38
|
+
width=0.75];
|
|
39
|
+
}
|
|
40
|
+
x [height=0.5,
|
|
41
|
+
pos="0,178",
|
|
42
|
+
width=0.75];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|