mirror of
https://github.com/safishamsi/graphify.git
synced 2026-10-16 08:59:26 +00:00
fix(export): prevent vis-network stack overflow crash on HTML render
Resolves the `BarnesHutSolver.js` maximum call stack size exceeded error. By explicitly initializing node X/Y coordinates using a sunflower spiral (Fermat's spiral) formula, nodes no longer spawn stacked on top of each other. This prevents `avoidOverlap` physics forces from dividing by zero and exploding into infinite values on the very first frame.
This commit is contained in:
1 parent
b9cd957072
commit
a20b3593bd
1 file changed
+2
@@ -151,6 +151,8 @@ function esc(s) {{
|
||||
const nodesDS = new vis.DataSet(RAW_NODES.map(n => ({{
|
||||
id: n.id, label: n.label, color: n.color, size: n.size,
|
||||
font: n.font, title: n.title,
|
||||
x: 30 * Math.sqrt(i) * Math.cos(i * 2.4),
|
||||
y: 30 * Math.sqrt(i) * Math.sin(i * 2.4),
|
||||
_community: n.community, _community_name: n.community_name,
|
||||
_source_file: n.source_file, _file_type: n.file_type, _degree: n.degree,
|
||||
}})));
|
||||
|
||||
Reference in new issue
Block a user