✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.
fix: node size calculation
AykutSaracb032eb88917d
diff --git a/src/features/editor/views/GraphView/lib/jsonParser.ts b/src/features/editor/views/GraphView/lib/jsonParser.tsindex 124dca90..a1baf0e0 100644--- a/src/features/editor/views/GraphView/lib/jsonParser.ts+++ b/src/features/editor/views/GraphView/lib/jsonParser.ts@@ -76,11 +76,7 @@ export function parser(jsonStr: string): Graph {// filter parent nodes that have no children// not the best way to do this, but it worksconst filteredNodes = states.graph.nodes.filter(node => {- if (node.data.isParent && node.data.childrenCount === 0) {- return false;- }-- return true;+ return !(node.data.isParent && node.data.childrenCount === 0);});// add path to nodesdiff --git a/src/features/editor/views/GraphView/lib/utils/calculateNodeSize.ts b/src/features/editor/views/GraphView/lib/utils/calculateNodeSize.tsindex 16aa81fe..026971d8 100644--- a/src/features/editor/views/GraphView/lib/utils/calculateNodeSize.ts+++ b/src/features/editor/views/GraphView/lib/utils/calculateNodeSize.ts@@ -26,7 +26,7 @@ const calculateWidthAndHeight = (str: string, single = false) => {const dummyElement = document.createElement("div");dummyElement.style.whiteSpace = single ? "nowrap" : "pre-wrap";- dummyElement.innerHTML = str;+ dummyElement.innerText = str;dummyElement.style.fontSize = "12px";dummyElement.style.width = "fit-content";dummyElement.style.padding = "0 10px";