浏览代码

increase node size per line to fit

AykutSarac 3 年之前
父节点
当前提交
40f066d76a
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/containers/LiveEditor/helpers.ts

+ 3 - 1
src/containers/LiveEditor/helpers.ts

@@ -32,6 +32,8 @@ export function getEdgeNodes(graph: any, isExpanded: boolean = true): any {
         .sort((a, b) => a - b);
       const longestLine = lineLengths.reverse()[0];
 
+      const height = (lines.length * 14 < 30 ? 30 : lines.length * 14) + 10;
+
       nodes.push({
         id: el.id,
         text: toString(el.text),
@@ -39,7 +41,7 @@ export function getEdgeNodes(graph: any, isExpanded: boolean = true): any {
           isParent: el.parent,
         },
         width: isExpanded ? 35 + longestLine * 8 : 180,
-        height: 30 + lines.length * 10,
+        height,
       });
     } else {
       edges.push(el);