@knowvah/dot-engine 1.2.6 → 1.3.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/dist/api/geometry.d.ts +24 -1
- package/dist/api/geometry.d.ts.map +1 -1
- package/dist/api.js +8 -0
- package/dist/api.js.map +2 -2
- package/dist/index.js +8 -0
- package/dist/index.js.map +2 -2
- package/package.json +7 -3
- package/src/api/geometry.ts +41 -2
package/dist/api/geometry.d.ts
CHANGED
|
@@ -85,7 +85,14 @@ export interface NodeGeometry {
|
|
|
85
85
|
* in order. An edge with no routed spline produces an empty `points` array.
|
|
86
86
|
* `label` is present only when the edge carries a centre label.
|
|
87
87
|
*
|
|
88
|
-
*
|
|
88
|
+
* `tailLabel`/`headLabel` are the `taillabel`/`headlabel` port labels. They
|
|
89
|
+
* are present only once the layout has actually *placed* them (C `lp->set`),
|
|
90
|
+
* which is the same gate `render()` applies before emitting the `<text>`:
|
|
91
|
+
* a declared port label that place_portlabel skipped (no spline, IGNORED edge
|
|
92
|
+
* type) still holds calloc-zero coordinates, so it is reported as absent
|
|
93
|
+
* rather than as a label at the origin.
|
|
94
|
+
*
|
|
95
|
+
* @see lib/common/types.h:ED_spl, ED_label, ED_tail_label, ED_head_label
|
|
89
96
|
*/
|
|
90
97
|
export interface EdgeGeometry {
|
|
91
98
|
tail: string;
|
|
@@ -100,6 +107,22 @@ export interface EdgeGeometry {
|
|
|
100
107
|
x: number;
|
|
101
108
|
y: number;
|
|
102
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* `taillabel` position, if placed.
|
|
112
|
+
* @see lib/common/types.h:ED_tail_label
|
|
113
|
+
*/
|
|
114
|
+
tailLabel?: {
|
|
115
|
+
x: number;
|
|
116
|
+
y: number;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* `headlabel` position, if placed.
|
|
120
|
+
* @see lib/common/types.h:ED_head_label
|
|
121
|
+
*/
|
|
122
|
+
headLabel?: {
|
|
123
|
+
x: number;
|
|
124
|
+
y: number;
|
|
125
|
+
};
|
|
103
126
|
}
|
|
104
127
|
/**
|
|
105
128
|
* Per-cluster geometry extracted after layout, in points.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/api/geometry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/api/geometry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAU/C,+CAA+C;AAC/C,MAAM,MAAM,KAAK,GAAG,IAAI,GAAG,MAAM,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnC,+EAA+E;IAC/E,KAAK,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC;;;OAGG;IACH,SAAS,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC;;;OAGG;IACH,SAAS,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACtC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AA2ID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,cAAc,CAuB1E"}
|
package/dist/api.js
CHANGED
|
@@ -686,6 +686,10 @@ function collectEdgePoints(edge, flipY) {
|
|
|
686
686
|
}
|
|
687
687
|
return pts;
|
|
688
688
|
}
|
|
689
|
+
function placedLabelPos(lbl, flipY) {
|
|
690
|
+
if (lbl === void 0 || !lbl.set) return void 0;
|
|
691
|
+
return { x: lbl.pos.x, y: flipY(lbl.pos.y) };
|
|
692
|
+
}
|
|
689
693
|
function snapshotEdge(edge, flipY) {
|
|
690
694
|
const geom = {
|
|
691
695
|
tail: edge.tail.name,
|
|
@@ -696,6 +700,10 @@ function snapshotEdge(edge, flipY) {
|
|
|
696
700
|
if (lbl !== void 0) {
|
|
697
701
|
geom.label = { x: lbl.pos.x, y: flipY(lbl.pos.y) };
|
|
698
702
|
}
|
|
703
|
+
const tailLabel = placedLabelPos(edge.info.tail_label, flipY);
|
|
704
|
+
if (tailLabel !== void 0) geom.tailLabel = tailLabel;
|
|
705
|
+
const headLabel = placedLabelPos(edge.info.head_label, flipY);
|
|
706
|
+
if (headLabel !== void 0) geom.headLabel = headLabel;
|
|
699
707
|
return geom;
|
|
700
708
|
}
|
|
701
709
|
function snapshotCluster(sg, yAxis, flipY) {
|