@markdy/core 1.0.22 → 1.0.24
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/index.js +6 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -995,7 +995,7 @@ function layoutRanked(ast, edges, opts) {
|
|
|
995
995
|
return nodes;
|
|
996
996
|
}
|
|
997
997
|
const maxPossibleStep = rankCount > 1 ? (contentW - NODE_W) / (rankCount - 1) : 0;
|
|
998
|
-
const colGap = rankCount > 1 ? Math.min(
|
|
998
|
+
const colGap = rankCount > 1 ? Math.min(300, Math.max(50, maxPossibleStep)) : 0;
|
|
999
999
|
const totalW = (rankCount - 1) * colGap + NODE_W;
|
|
1000
1000
|
const startX = SAFE + Math.max(0, (contentW - totalW) / 2);
|
|
1001
1001
|
for (const [rank, ids] of [...byRank.entries()].sort((a, b) => a[0] - b[0])) {
|
|
@@ -1622,10 +1622,12 @@ function layoutLayers(ast) {
|
|
|
1622
1622
|
function layoutNested(ast) {
|
|
1623
1623
|
const nodeIds = Object.keys(ast.nodes);
|
|
1624
1624
|
if (nodeIds.length === 0) return [];
|
|
1625
|
+
const topHeadroom = 20;
|
|
1626
|
+
const startY = TITLE_BAND + topHeadroom;
|
|
1625
1627
|
const contentW = ast.meta.width - SAFE * 2;
|
|
1626
|
-
const contentH = ast.meta.height -
|
|
1628
|
+
const contentH = ast.meta.height - startY - SAFE;
|
|
1627
1629
|
const centerX = SAFE + contentW / 2;
|
|
1628
|
-
const centerY =
|
|
1630
|
+
const centerY = startY + contentH / 2;
|
|
1629
1631
|
const N = nodeIds.length;
|
|
1630
1632
|
const padX = Math.min(54, contentW * 0.42 / Math.max(N, 1));
|
|
1631
1633
|
const padY = Math.min(48, contentH * 0.42 / Math.max(N, 1));
|
|
@@ -1641,7 +1643,7 @@ function layoutNested(ast) {
|
|
|
1641
1643
|
y = centerY - h / 2 + (N > 1 ? 16 : 0);
|
|
1642
1644
|
} else {
|
|
1643
1645
|
x = SAFE + idx * padX;
|
|
1644
|
-
y =
|
|
1646
|
+
y = startY + idx * padY;
|
|
1645
1647
|
w = contentW - idx * padX * 2;
|
|
1646
1648
|
h = contentH - idx * padY * 2;
|
|
1647
1649
|
}
|
package/package.json
CHANGED