From 56ee2434e70c791404a75ffd91d6bb1870cadbd8 Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Wed, 4 Aug 2021 09:00:38 +0200 Subject: [PATCH] fix(Vis View): Center graph in Vis View --- src/VisModal.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/VisModal.ts b/src/VisModal.ts index 31342af5..5d46ee97 100644 --- a/src/VisModal.ts +++ b/src/VisModal.ts @@ -191,7 +191,13 @@ export class VisModal extends Modal { d3.forceLink(links).id((d) => d.id) ) .force("charge", d3.forceManyBody()) - .force("center", d3.forceCenter(width / 2, height / 2)); + .force( + "center", + d3.forceCenter( + parseInt(contentEl.style.width) / 2, + parseInt(contentEl.style.height) / 2 + ) + ); const svg = d3 .select(".d3-graph")