@knowvah/dot-engine 1.2.7 → 1.4.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 +54 -1
- package/dist/api/geometry.d.ts.map +1 -1
- package/dist/api.js +21 -0
- package/dist/api.js.map +2 -2
- package/dist/index.js +21 -0
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/src/api/geometry.ts +91 -2
package/dist/index.js
CHANGED
|
@@ -53413,6 +53413,20 @@ function collectEdgePoints(edge, flipY) {
|
|
|
53413
53413
|
}
|
|
53414
53414
|
return pts;
|
|
53415
53415
|
}
|
|
53416
|
+
function placedLabelPos(lbl, flipY) {
|
|
53417
|
+
if (lbl === void 0 || !lbl.set) return void 0;
|
|
53418
|
+
return { x: lbl.pos.x, y: flipY(lbl.pos.y) };
|
|
53419
|
+
}
|
|
53420
|
+
function arrowAttachPoints(edge, flipY) {
|
|
53421
|
+
const spl = edge.info.spl;
|
|
53422
|
+
if (spl === void 0 || spl.size === 0) return {};
|
|
53423
|
+
const out = {};
|
|
53424
|
+
const first = spl.list[0];
|
|
53425
|
+
if (first.sflag !== 0) out.sp = { x: first.sp.x, y: flipY(first.sp.y) };
|
|
53426
|
+
const last = spl.list[spl.size - 1];
|
|
53427
|
+
if (last.eflag !== 0) out.ep = { x: last.ep.x, y: flipY(last.ep.y) };
|
|
53428
|
+
return out;
|
|
53429
|
+
}
|
|
53416
53430
|
function snapshotEdge(edge, flipY) {
|
|
53417
53431
|
const geom = {
|
|
53418
53432
|
tail: edge.tail.name,
|
|
@@ -53423,6 +53437,13 @@ function snapshotEdge(edge, flipY) {
|
|
|
53423
53437
|
if (lbl !== void 0) {
|
|
53424
53438
|
geom.label = { x: lbl.pos.x, y: flipY(lbl.pos.y) };
|
|
53425
53439
|
}
|
|
53440
|
+
const tailLabel = placedLabelPos(edge.info.tail_label, flipY);
|
|
53441
|
+
if (tailLabel !== void 0) geom.tailLabel = tailLabel;
|
|
53442
|
+
const headLabel = placedLabelPos(edge.info.head_label, flipY);
|
|
53443
|
+
if (headLabel !== void 0) geom.headLabel = headLabel;
|
|
53444
|
+
const { sp, ep } = arrowAttachPoints(edge, flipY);
|
|
53445
|
+
if (sp !== void 0) geom.sp = sp;
|
|
53446
|
+
if (ep !== void 0) geom.ep = ep;
|
|
53426
53447
|
return geom;
|
|
53427
53448
|
}
|
|
53428
53449
|
function snapshotCluster(sg, yAxis, flipY) {
|