aboutsummaryrefslogtreecommitdiffstats
path: root/src/layout.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout.js')
-rw-r--r--src/layout.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/layout.js b/src/layout.js
index a19bc00..95237c5 100644
--- a/src/layout.js
+++ b/src/layout.js
@@ -8,7 +8,7 @@ export const init = () => {
export const addNode = (dot, node) => {
const id = node.data.id;
- dot += ` "${id}" [fixedsize=true; width=${node.width / 72}; height=${node.height / 72}];\n`;
+ dot += ` "${id}" [fixedsize=true; width=${node.dom.offsetWidth / 72}; height=${node.dom.offsetHeight / 72}];\n`;
for (const replyId of node.data.replies || [])
dot += ` "${id}" -> "${replyId}";\n`;
@@ -21,14 +21,12 @@ const toNumber = (i) => Number(i);
export const render = async (dot, canvas, setPosition, setSize) => {
dot += '}';
- console.log(dot);
-
- const info = await graphviz.renderJSONObject(dot, { format: 'json0' });
- window.info = info;
+ const info = await graphviz.renderJSONObject(dot, { format: 'json0' });
+ window.info = info;
const [_x, _y, width, height] = info.bb.split(',').map(toNumber);
- setSize(width, height);
+ setSize(width, height);
for (const object of info.objects) {
const [x, y] = object.pos.split(',').map(toNumber);