Skip to content

Commit

Permalink
fix(Vis View): Center graph in Vis View
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Aug 4, 2021
1 parent d82ef5a commit 56ee243
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/VisModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 56ee243

Please sign in to comment.