@knowvah/dot-engine 2.12.1 → 2.12.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/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/compass-port.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/graph-init.d.ts.map +1 -1
- package/dist/common/htmltable-label.d.ts.map +1 -1
- package/dist/common/htmltable-lex.d.ts +3 -1
- package/dist/common/htmltable-lex.d.ts.map +1 -1
- package/dist/common/htmltable-parse-image.d.ts +23 -0
- package/dist/common/htmltable-parse-image.d.ts.map +1 -0
- package/dist/common/htmltable-parse-state.d.ts +4 -0
- package/dist/common/htmltable-parse-state.d.ts.map +1 -1
- package/dist/common/htmltable-parse.d.ts +33 -2
- package/dist/common/htmltable-parse.d.ts.map +1 -1
- package/dist/common/nodeinit.d.ts +16 -2
- package/dist/common/nodeinit.d.ts.map +1 -1
- package/dist/common/poly-inside.d.ts.map +1 -1
- package/dist/common/splines-geom.d.ts +2 -1
- package/dist/common/splines-geom.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/common/splines-routespl.d.ts +3 -0
- package/dist/common/splines-routespl.d.ts.map +1 -1
- package/dist/gvc/context.d.ts +8 -0
- package/dist/gvc/context.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 +7 -6
- 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 +21565 -21326
- package/dist/index.js.map +4 -4
- package/dist/layout/dot/classify.d.ts.map +1 -1
- package/dist/layout/dot/edge-route-chain-views.d.ts +35 -0
- package/dist/layout/dot/edge-route-chain-views.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-chain.d.ts +20 -16
- package/dist/layout/dot/edge-route-chain.d.ts.map +1 -1
- package/dist/layout/dot/edge-route-faithful.d.ts.map +1 -1
- package/dist/layout/dot/edge-route.d.ts +7 -3
- 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/flat.d.ts +22 -7
- package/dist/layout/dot/flat.d.ts.map +1 -1
- package/dist/layout/dot/init.d.ts +49 -9
- 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/mincross-flat.d.ts +10 -1
- package/dist/layout/dot/mincross-flat.d.ts.map +1 -1
- package/dist/layout/dot/mincross.d.ts +6 -1
- package/dist/layout/dot/mincross.d.ts.map +1 -1
- package/dist/layout/dot/ns-subtree.d.ts +9 -6
- package/dist/layout/dot/ns-subtree.d.ts.map +1 -1
- package/dist/layout/dot/pack-components.d.ts +4 -3
- package/dist/layout/dot/pack-components.d.ts.map +1 -1
- package/dist/layout/dot/position-aux.d.ts +69 -21
- package/dist/layout/dot/position-aux.d.ts.map +1 -1
- package/dist/layout/dot/position-bbox.d.ts.map +1 -1
- package/dist/layout/dot/position-ycoords.d.ts.map +1 -1
- package/dist/layout/dot/position.d.ts.map +1 -1
- package/dist/layout/dot/rank-dot2.d.ts +7 -25
- package/dist/layout/dot/rank-dot2.d.ts.map +1 -1
- package/dist/layout/dot/self-loop.d.ts +11 -4
- package/dist/layout/dot/self-loop.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-multi.d.ts +11 -3
- package/dist/layout/dot/splines-flat-multi.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-route.d.ts +6 -3
- package/dist/layout/dot/splines-route.d.ts.map +1 -1
- package/dist/layout/dot/straight-edges.d.ts.map +1 -1
- package/dist/layout/fdp/ports.d.ts.map +1 -1
- package/dist/layout/fdp/tlayout.d.ts +3 -0
- package/dist/layout/fdp/tlayout.d.ts.map +1 -1
- package/dist/layout/neato/__fixtures__/hier-imds.d.ts +5 -4
- package/dist/layout/neato/__fixtures__/hier-imds.d.ts.map +1 -1
- package/dist/layout/neato/__fixtures__/hier-majorization.d.ts +6 -5
- package/dist/layout/neato/__fixtures__/hier-majorization.d.ts.map +1 -1
- package/dist/layout/neato/conjgrad-mkernel.d.ts.map +1 -1
- package/dist/layout/neato/conjgrad.d.ts +7 -6
- package/dist/layout/neato/conjgrad.d.ts.map +1 -1
- package/dist/layout/neato/matrix-ops-dense.d.ts +1 -6
- package/dist/layout/neato/matrix-ops-dense.d.ts.map +1 -1
- package/dist/layout/neato/matrix-ops.d.ts +0 -6
- package/dist/layout/neato/matrix-ops.d.ts.map +1 -1
- package/dist/layout/neato/quad-prog-vpsc.d.ts.map +1 -1
- package/dist/layout/neato/sgd.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/model/rankEntry.d.ts +3 -1
- package/dist/model/rankEntry.d.ts.map +1 -1
- package/dist/ortho/index.d.ts +0 -1
- package/dist/ortho/index.d.ts.map +1 -1
- package/dist/ortho/partition.d.ts +2 -4
- package/dist/ortho/partition.d.ts.map +1 -1
- package/dist/parser/builder.d.ts.map +1 -1
- package/dist/pathplan/route.d.ts +93 -0
- package/dist/pathplan/route.d.ts.map +1 -1
- package/dist/render/dot/agwrite.d.ts +26 -10
- 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/types.d.ts +7 -2
- package/dist/render/dot/types.d.ts.map +1 -1
- package/dist/render/dot/write-back.d.ts +14 -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 +4 -2
- package/dist/render/dot.d.ts.map +1 -1
- package/dist/render/json-cluster-edge.d.ts +17 -4
- package/dist/render/json-cluster-edge.d.ts.map +1 -1
- 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 +21517 -21278
- package/dist/render.js.map +4 -4
- package/dist/util/bsd-qsort.d.ts.map +1 -1
- package/dist/util/overflow.d.ts +37 -0
- package/dist/util/overflow.d.ts.map +1 -0
- 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 +3 -2
- package/src/api/builder.ts +8 -2
- package/src/common/compass-port.ts +36 -20
- package/src/common/edge-label-init.ts +43 -17
- package/src/common/graph-init.ts +11 -1
- package/src/common/htmltable-label.ts +9 -4
- package/src/common/htmltable-lex.ts +5 -2
- package/src/common/htmltable-parse-image.ts +69 -0
- package/src/common/htmltable-parse-state.ts +6 -0
- package/src/common/htmltable-parse.ts +34 -44
- package/src/common/nodeinit.ts +28 -8
- package/src/common/poly-inside.ts +11 -5
- package/src/common/splines-geom.ts +24 -6
- package/src/common/splines-path-begin.ts +4 -3
- package/src/common/splines-path-end.ts +4 -3
- package/src/common/splines-routespl.ts +32 -0
- package/src/gvc/__fixtures__/rerender/abom-shift-pack.dot.plain.nofree.1 +19 -19
- package/src/gvc/__fixtures__/rerender/abom-shift-pack.dot.plain.nofree.2 +19 -19
- package/src/gvc/__fixtures__/rerender/abom-shift-pack.dot.plain.nofree.3 +19 -19
- package/src/gvc/__fixtures__/rerender/abom-shift-parity.dot.plain.nofree.2 +18 -18
- package/src/gvc/__fixtures__/rerender/abom-shift-parity.dot.plain.nofree.3 +12 -12
- package/src/gvc/__fixtures__/rerender/flat-rev-stale.dot.plain.nofree.1 +20 -20
- package/src/gvc/__fixtures__/rerender/flat-rev-stale.dot.plain.nofree.2 +31 -31
- package/src/gvc/__fixtures__/rerender/flat-rev-stale.dot.plain.nofree.3 +33 -33
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.1 +10 -10
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.2 +28 -28
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.3 +28 -28
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.svg.nofree.1 +21 -28
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.svg.nofree.2 +100 -102
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.svg.nofree.3 +137 -139
- package/src/gvc/__fixtures__/rerender/nestedclust.dot.dot.nofree.1 +1 -1
- package/src/gvc/__fixtures__/rerender/nestedclust.dot.dot.nofree.2 +1 -1
- package/src/gvc/__fixtures__/rerender/nestedclust.dot.dot.nofree.3 +1 -1
- package/src/gvc/__fixtures__/rerender/nestedclust.dot.xdot.nofree.1 +3 -3
- package/src/gvc/__fixtures__/rerender/nestedclust.dot.xdot.nofree.2 +3 -3
- package/src/gvc/__fixtures__/rerender/nestedclust.dot.xdot.nofree.3 +3 -3
- package/src/gvc/__fixtures__/rerender/regen.sh +6 -0
- package/src/gvc/context.ts +8 -0
- package/src/gvc/device.ts +6 -6
- package/src/gvc/emit-gates.ts +6 -15
- package/src/gvc/emit-xdot.ts +10 -11
- 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/classify.ts +5 -2
- package/src/layout/dot/edge-route-chain-views.ts +120 -0
- package/src/layout/dot/edge-route-chain.ts +103 -117
- package/src/layout/dot/edge-route-faithful.ts +20 -5
- package/src/layout/dot/edge-route.ts +44 -49
- package/src/layout/dot/fastgr.ts +9 -3
- package/src/layout/dot/flat-adj-record.ts +68 -0
- package/src/layout/dot/flat.ts +38 -17
- package/src/layout/dot/init.ts +59 -13
- package/src/layout/dot/mincross-build.ts +14 -1
- package/src/layout/dot/mincross-flat.ts +15 -5
- package/src/layout/dot/mincross.ts +6 -2
- package/src/layout/dot/ns-subtree.ts +11 -7
- package/src/layout/dot/pack-components.ts +6 -4
- package/src/layout/dot/position-aux.ts +122 -42
- package/src/layout/dot/position-bbox.ts +14 -1
- package/src/layout/dot/position-ycoords.ts +7 -1
- package/src/layout/dot/position.ts +4 -1
- package/src/layout/dot/rank-dot2.ts +13 -94
- package/src/layout/dot/self-loop.ts +29 -11
- 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-multi.ts +12 -4
- package/src/layout/dot/splines-flat.ts +9 -19
- package/src/layout/dot/splines-groups.ts +5 -3
- package/src/layout/dot/splines-route.ts +10 -11
- package/src/layout/dot/straight-edges.ts +5 -3
- package/src/layout/fdp/ports.ts +6 -2
- package/src/layout/fdp/tlayout.ts +6 -5
- package/src/layout/neato/__fixtures__/conjgrad-d.json +1 -0
- package/src/layout/neato/__fixtures__/dim/hier-big-dim3.dot +141 -141
- package/src/layout/neato/__fixtures__/dim/hier-big-dim3.xdot +339 -339
- package/src/layout/neato/__fixtures__/dim/hier-big-dim4.dot +140 -140
- package/src/layout/neato/__fixtures__/dim/hier-big-dim4.xdot +323 -323
- package/src/layout/neato/__fixtures__/dim/hier-big-subset-dim3.dot +141 -141
- package/src/layout/neato/__fixtures__/dim/hier-big-subset-dim3.xdot +339 -339
- package/src/layout/neato/__fixtures__/dim/hier-big110-dim3.dot +251 -251
- package/src/layout/neato/__fixtures__/dim/hier-big110-dim3.xdot +535 -535
- package/src/layout/neato/__fixtures__/dim/hier-circuit-dim3.dot +14 -14
- package/src/layout/neato/__fixtures__/dim/hier-circuit-dim3.xdot +32 -32
- package/src/layout/neato/__fixtures__/dim/hier-dim4.dot +8 -8
- package/src/layout/neato/__fixtures__/dim/hier-dim4.xdot +14 -14
- package/src/layout/neato/__fixtures__/dim/hier-len-dim3.dot +17 -17
- package/src/layout/neato/__fixtures__/dim/hier-len-dim3.xdot +35 -35
- package/src/layout/neato/__fixtures__/dim/hier-noedge-big.dot +2 -2
- package/src/layout/neato/__fixtures__/dim/hier-noedge-big.xdot +2 -2
- package/src/layout/neato/__fixtures__/dim/hier-ring-dim3.dot +11 -11
- package/src/layout/neato/__fixtures__/dim/hier-ring-dim3.xdot +21 -21
- package/src/layout/neato/__fixtures__/dim/hier-star-dim3.dot +14 -14
- package/src/layout/neato/__fixtures__/dim/hier-star-dim3.xdot +26 -26
- package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim4.dot +13 -13
- package/src/layout/neato/__fixtures__/dim/hier-stresswt1-dim4.xdot +30 -30
- package/src/layout/neato/__fixtures__/dim/hier-subset-dim3.dot +10 -10
- package/src/layout/neato/__fixtures__/dim/hier-subset-dim3.xdot +19 -19
- package/src/layout/neato/__fixtures__/dim/smart-units.json +1 -1
- package/src/layout/neato/__fixtures__/hier/cases/dirnone.plain +10 -10
- package/src/layout/neato/__fixtures__/hier/cases/tdist.plain +12 -12
- package/src/layout/neato/__fixtures__/hier/hier-probe.plain +1 -1
- package/src/layout/neato/__fixtures__/hier/hier-probe.xdot +19 -19
- package/src/layout/neato/__fixtures__/hier-imds.ts +14 -13
- package/src/layout/neato/__fixtures__/hier-majorization.ts +24 -23
- package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.xdot +20 -20
- package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.xdot +8 -8
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.xdot +34 -34
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.xdot +32 -32
- package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.xdot +18 -18
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.xdot +13 -13
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.xdot +12 -12
- package/src/layout/neato/__fixtures__/models/hier-circuit.xdot +33 -33
- package/src/layout/neato/__fixtures__/models/hier-default.xdot +30 -30
- package/src/layout/neato/__fixtures__/models/hier-mds-nolen.xdot +30 -30
- package/src/layout/neato/__fixtures__/models/hier-pin-disc-circuit.xdot +35 -35
- package/src/layout/neato/__fixtures__/models/hier-shortpath.xdot +30 -30
- package/src/layout/neato/conjgrad-mkernel.ts +6 -2
- package/src/layout/neato/conjgrad.ts +38 -35
- package/src/layout/neato/matrix-ops-dense.ts +2 -20
- package/src/layout/neato/matrix-ops.ts +0 -20
- package/src/layout/neato/quad-prog-vpsc.ts +7 -5
- package/src/layout/neato/sgd.ts +2 -1
- package/src/layout/neato/smart-ini-x.ts +15 -15
- package/src/layout/neato/stress-subspace.ts +5 -5
- package/src/layout/sfdp/__fixtures__/dim/dim3-dimen3.dot +6 -6
- package/src/layout/sfdp/__fixtures__/dim/dim3.dot +6 -6
- package/src/layout/sfdp/__fixtures__/dim/dim4-dimen4.dot +6 -6
- package/src/layout/sfdp/__fixtures__/dim/overlap-prism-dim3.dot +6 -6
- package/src/layout/sfdp/__fixtures__/dim/regen.sh +2 -0
- 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/model/rankEntry.ts +3 -1
- package/src/ortho/index.ts +0 -1
- package/src/ortho/partition.ts +10 -22
- package/src/parser/builder.ts +12 -3
- package/src/pathplan/route.ts +14 -4
- package/src/render/dot/agwrite.ts +45 -18
- package/src/render/dot/attrs.ts +18 -7
- package/src/render/dot/types.ts +7 -2
- package/src/render/dot/write-back.ts +27 -3
- package/src/render/dot/xdot-ops.ts +25 -56
- package/src/render/dot.ts +7 -5
- package/src/render/json-cluster-edge.ts +42 -5
- package/src/render/json-nonfinite.ts +51 -0
- package/src/render/json.ts +23 -26
- package/src/render/map.ts +3 -0
- package/src/render/svg-graph.ts +3 -15
- package/src/render/svg-id.ts +11 -2
- package/src/render/svg.ts +4 -1
- package/src/util/bsd-qsort.ts +2 -1
- package/src/util/overflow.ts +74 -0
- package/src/xdot/parse.ts +9 -19
- package/src/xdot/strtod.ts +167 -0
package/src/gvc/context.ts
CHANGED
|
@@ -64,6 +64,14 @@ export interface RendererPlugin {
|
|
|
64
64
|
readonly type: string;
|
|
65
65
|
/** Capability quality — higher wins when multiple plugins match the same format. */
|
|
66
66
|
readonly quality: number;
|
|
67
|
+
/**
|
|
68
|
+
* The pad around the drawing, in graph units (points), when the graph sets no
|
|
69
|
+
* `pad=`. A renderer that omits it gets `DEFAULT_GRAPH_PAD`, as C's output
|
|
70
|
+
* languages that are not render plugins do.
|
|
71
|
+
* @see lib/gvc/gvcjob.h gvrender_features_t.default_pad
|
|
72
|
+
* @see lib/common/emit.c:3290-3304 init_job_pad
|
|
73
|
+
*/
|
|
74
|
+
readonly defaultPad?: number;
|
|
67
75
|
|
|
68
76
|
beginGraph(g: Graph, job: RenderJob): void;
|
|
69
77
|
endGraph(g: Graph, job: RenderJob): void;
|
package/src/gvc/device.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import { POINTS_PER_INCH } from '../model/geom.js';
|
|
16
16
|
import { lateDouble } from '../common/nodeinit.js';
|
|
17
|
-
import { parseDrawingSize, initJobViewportZoom, parseLandscape, parseGraphPad, parseGraphMargin } from './viewport.js';
|
|
17
|
+
import { parseDrawingSize, initJobViewportZoom, parseLandscape, parseGraphPad, parseGraphMargin, DEFAULT_GRAPH_PAD } from './viewport.js';
|
|
18
18
|
import type { Graph } from '../model/graph.js';
|
|
19
19
|
import type { Node } from '../model/node.js';
|
|
20
20
|
import type { Edge } from '../model/edge.js';
|
|
@@ -231,7 +231,7 @@ export function renderEdge(e: Edge, renderer: RendererPlugin, job: RenderJob): v
|
|
|
231
231
|
* @see lib/common/emit.c:emit_page (3656-3657)
|
|
232
232
|
*/
|
|
233
233
|
export function renderGraphLabel(g: Graph, renderer: RendererPlugin, job: RenderJob): void {
|
|
234
|
-
// @see lib/common/emit.c:emit_begin_graph / getObjId (
|
|
234
|
+
// @see lib/common/emit.c:emit_begin_graph / getObjId (graph being emitted → graph<AGSEQ>)
|
|
235
235
|
setHtmlAnchorObj(svgGraphId(g, job), labelTextOf(g.info.label), job.obj ?? undefined);
|
|
236
236
|
renderOneLabel(g.info.label as TextlabelT | undefined, renderer, job, false);
|
|
237
237
|
}
|
|
@@ -450,10 +450,10 @@ export function render(ctx: GvcContext, g: Graph, format: string, inlineImages =
|
|
|
450
450
|
// a recompute, it is the mechanism that produces C's near-empty output.
|
|
451
451
|
// @see lib/common/emit.c:3272 init_gvc (gvc->bb = GD_bb(g))
|
|
452
452
|
job.bb = g.info.bb;
|
|
453
|
-
// init_job_pad: job.pad from `pad=`,
|
|
454
|
-
//
|
|
453
|
+
// init_job_pad: job.pad from `pad=`, else the render device's default pad,
|
|
454
|
+
// before the size= fit, which uses the padded bb (emit.c:4289-4291).
|
|
455
455
|
// @see lib/common/emit.c:3241-3251 (attr read); :3290-3304 (fallback)
|
|
456
|
-
job.pad = parseGraphPad(g.attrs.get('pad'));
|
|
456
|
+
job.pad = parseGraphPad(g.attrs.get('pad'), renderer.defaultPad ?? DEFAULT_GRAPH_PAD);
|
|
457
457
|
// init_job_margin, right after init_job_pad (emit.c:4290-4291). margin does
|
|
458
458
|
// not feed the size= fit (only pad does); emitSvgTag/svgBeginPage use it after
|
|
459
459
|
// Z is known, as C resolves it before init_job_viewport and uses it after.
|
|
@@ -478,7 +478,7 @@ export function render(ctx: GvcContext, g: Graph, format: string, inlineImages =
|
|
|
478
478
|
// not job->zoom. job.scale is read only by the SVG group/dims.
|
|
479
479
|
const drawingSize = parseDrawingSize(g.attrs.get('size'));
|
|
480
480
|
const z = initJobViewportZoom(job.bb, drawingSize, job.pad);
|
|
481
|
-
job.clip = deviceClip(g,
|
|
481
|
+
job.clip = deviceClip(g, job); // @see lib/common/emit.c:1550-1564 setup_page
|
|
482
482
|
// init_job_dpi (emit.c:3333): GD_drawing->dpi = late_double(dpi, resolution, 0)
|
|
483
483
|
// (input.c:713). When >0 it becomes job->dpi; otherwise the SVG device's
|
|
484
484
|
// default_dpi = 72 (gvrender_core_svg.c:814) applies. init_job_viewport then
|
package/src/gvc/emit-gates.ts
CHANGED
|
@@ -31,27 +31,18 @@ function nodeBBox(n: Node): Box {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* node_in_box: is the node's own bbox within job's page
|
|
34
|
+
* node_in_box: is the node's own bbox within the job's page clip?
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* port implements — Z and rotation cancel out of that derivation). This port
|
|
41
|
-
* has no separate `page=` pagination model, so `job.bb` padded by `job.pad`
|
|
42
|
-
* IS `job->clip` here.
|
|
36
|
+
* emit_node passes `job->clip`, which setup_page builds from the bb padded by
|
|
37
|
+
* the device's pad (see deviceClip). The edge gate, the clusters and the
|
|
38
|
+
* background read the same box, so `job.clip` has to be set before a node is
|
|
39
|
+
* rendered; `render` sets it.
|
|
43
40
|
*
|
|
44
41
|
* @see lib/common/emit.c:1636-1639 node_in_box
|
|
45
42
|
* @see lib/common/emit.c:1808 emit_node gate
|
|
46
|
-
* @see lib/common/emit.c:3356 init_job_viewport (job->bb = gvc->bb ± pad)
|
|
47
|
-
* @see lib/common/emit.c:1553-1564 setup_page (job->clip from focus/view)
|
|
48
43
|
*/
|
|
49
44
|
export function nodeInBox(n: Node, job: RenderJob): boolean {
|
|
50
|
-
|
|
51
|
-
ll: { x: job.bb.ll.x - job.pad.x, y: job.bb.ll.y - job.pad.y },
|
|
52
|
-
ur: { x: job.bb.ur.x + job.pad.x, y: job.bb.ur.y + job.pad.y },
|
|
53
|
-
};
|
|
54
|
-
return boxOverlap(nodeBBox(n), clip);
|
|
45
|
+
return boxOverlap(nodeBBox(n), job.clip);
|
|
55
46
|
}
|
|
56
47
|
|
|
57
48
|
/**
|
package/src/gvc/emit-xdot.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { transformPoint } from './device-transform.js';
|
|
|
19
19
|
import { graphXdots } from './init-xdot.js';
|
|
20
20
|
import { gvrenderSetStyle } from './gvrender-set-style.js';
|
|
21
21
|
import type { ObjState, RenderJob } from './job.js';
|
|
22
|
-
import { initJobViewportZoom, parseDrawingSize,
|
|
22
|
+
import { initJobViewportZoom, parseDrawingSize, setupPageClip } from './viewport.js';
|
|
23
23
|
|
|
24
24
|
/** @see lib/common/const.h:48 */
|
|
25
25
|
const DEFAULT_COLOR = 'black';
|
|
@@ -30,17 +30,16 @@ const DEFAULT_FILL = 'lightgrey';
|
|
|
30
30
|
const DEFAULT_LINE_STYLE: readonly string[] = ['solid', 'setlinewidth(1)'];
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* job->clip
|
|
34
|
-
*
|
|
35
|
-
* `pad
|
|
36
|
-
*
|
|
37
|
-
* @see lib/common/emit.c:
|
|
33
|
+
* job->clip, computed in C's order, rounding included, from the bb and
|
|
34
|
+
* `job.pad`. init_job_pad has already made that pad the device's: with no
|
|
35
|
+
* `pad=` it is 4 on svg and map, and 0 on dot, xdot, plain and json, whose clip
|
|
36
|
+
* is then the bb.
|
|
37
|
+
* @see lib/common/emit.c:3290-3304 init_job_pad
|
|
38
|
+
* @see lib/common/emit.c:1550-1564 setup_page
|
|
38
39
|
*/
|
|
39
|
-
export function deviceClip(g: Graph,
|
|
40
|
-
const attr = g.attrs.get('pad');
|
|
41
|
-
const pad = renderer.type === 'svg' ? job.pad : attr ? parseGraphPad(attr) : { x: 0, y: 0 };
|
|
40
|
+
export function deviceClip(g: Graph, job: RenderJob): Box {
|
|
42
41
|
const size = parseDrawingSize(g.attrs.get('size'));
|
|
43
|
-
return setupPageClip(job.bb, size, pad, initJobViewportZoom(job.bb, size, pad));
|
|
42
|
+
return setupPageClip(job.bb, size, job.pad, initJobViewportZoom(job.bb, size, job.pad));
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
/**
|
|
@@ -210,7 +209,7 @@ export function emitXdot(g: Graph, renderer: RendererPlugin, job: RenderJob): vo
|
|
|
210
209
|
const obj = job.obj;
|
|
211
210
|
if (xd === undefined || obj === null) return;
|
|
212
211
|
applyBackgroundState(g, renderer, obj);
|
|
213
|
-
const inClip = zeroBoxInClip(deviceClip(g,
|
|
212
|
+
const inClip = zeroBoxInClip(deviceClip(g, job));
|
|
214
213
|
const warned = { image: false };
|
|
215
214
|
let styled = false;
|
|
216
215
|
for (const op of xd.ops) {
|
package/src/gvc/job.ts
CHANGED
|
@@ -274,10 +274,13 @@ export class RenderJob {
|
|
|
274
274
|
readonly format: string;
|
|
275
275
|
|
|
276
276
|
bb: Box = { ll: { x: 0, y: 0 }, ur: { x: 0, y: 0 } };
|
|
277
|
+
/** `pad=`, or else the render device's default pad (`RendererPlugin.defaultPad`).
|
|
278
|
+
* @see lib/common/emit.c:3290-3304 init_job_pad */
|
|
277
279
|
pad: Point = { x: 0, y: 0 };
|
|
278
280
|
/** Current page clip in graph units, as setup_page computes it from the
|
|
279
|
-
* viewport focus/view (see setupPageClip). Read by the
|
|
280
|
-
*
|
|
281
|
+
* viewport focus/view (see setupPageClip). Read by the node and edge gates
|
|
282
|
+
* and by the SVG page translate and background.
|
|
283
|
+
* @see lib/gvc/gvcjob.h:GVJ_s.clip; lib/common/emit.c:setup_page */
|
|
281
284
|
clip: Box = { ll: { x: 0, y: 0 }, ur: { x: 0, y: 0 } };
|
|
282
285
|
/** Graph-level `margin=` (init_job_margin); page-pagination margin, distinct
|
|
283
286
|
* from node/cluster label margin. @see lib/common/emit.c:3309-3331 */
|
package/src/gvc/viewport.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
import type { Box, Point } from '../model/geom.js';
|
|
28
28
|
import { POINTS_PER_INCH } from '../model/geom.js';
|
|
29
|
-
import {
|
|
29
|
+
import { SVG_MARGIN } from '../render/svg-helpers.js';
|
|
30
30
|
import type { Graph } from '../model/graph.js';
|
|
31
31
|
import { cround } from '../common/arith.js';
|
|
32
32
|
|
|
@@ -76,14 +76,20 @@ export function parseDrawingSize(raw: string | undefined): DrawingSize | null {
|
|
|
76
76
|
return null;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/**
|
|
80
|
+
* The pad init_job_pad gives an output language that is not a render plugin,
|
|
81
|
+
* in points. Here it is the pad of a renderer that states no `defaultPad`.
|
|
82
|
+
* @see lib/common/const.h:96
|
|
83
|
+
*/
|
|
84
|
+
export const DEFAULT_GRAPH_PAD = 4;
|
|
85
|
+
|
|
79
86
|
/**
|
|
80
87
|
* Port of the `pad=` graph-attribute parse: init_gvc reads it via
|
|
81
88
|
* `sscanf(p, "%lf,%lf", &xf, &yf)` (2 values matched → both axes
|
|
82
89
|
* independently; 1 value → y = x; 0 matched — attr absent or unparsable —
|
|
83
|
-
* leaves `graph_sets_pad` false) and init_job_pad
|
|
84
|
-
* plugin's `default_pad` (
|
|
85
|
-
*
|
|
86
|
-
* branches collapse to the same constant here (`SVG_PAD`).
|
|
90
|
+
* leaves `graph_sets_pad` false) and init_job_pad then takes `fallback` on
|
|
91
|
+
* both axes: the render plugin's `default_pad` (`RendererPlugin.defaultPad`),
|
|
92
|
+
* or `DEFAULT_GRAPH_PAD` where there is none.
|
|
87
93
|
*
|
|
88
94
|
* Unlike `size=`, pad values are NOT rounded (`xf * POINTS_PER_INCH`
|
|
89
95
|
* directly — no `POINTS()` macro) and are not required to be positive.
|
|
@@ -91,7 +97,7 @@ export function parseDrawingSize(raw: string | undefined): DrawingSize | null {
|
|
|
91
97
|
* @see lib/common/emit.c:3241-3251 init_gvc (pad attr read)
|
|
92
98
|
* @see lib/common/emit.c:3290-3304 init_job_pad (fallback)
|
|
93
99
|
*/
|
|
94
|
-
export function parseGraphPad(raw: string | undefined): Point {
|
|
100
|
+
export function parseGraphPad(raw: string | undefined, fallback: number): Point {
|
|
95
101
|
if (raw !== undefined) {
|
|
96
102
|
const xy = PAD_XY_RE.exec(raw);
|
|
97
103
|
if (xy) {
|
|
@@ -103,7 +109,7 @@ export function parseGraphPad(raw: string | undefined): Point {
|
|
|
103
109
|
return { x: v, y: v };
|
|
104
110
|
}
|
|
105
111
|
}
|
|
106
|
-
return { x:
|
|
112
|
+
return { x: fallback, y: fallback };
|
|
107
113
|
}
|
|
108
114
|
|
|
109
115
|
/**
|