summaryrefslogtreecommitdiff
path: root/src/graph.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/graph.js')
-rw-r--r--src/graph.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/graph.js b/src/graph.js
index 5a09cbb..075eb97 100644
--- a/src/graph.js
+++ b/src/graph.js
@@ -288,19 +288,22 @@ export default function buildGraph({ db, handlers }) {
zoomIn();
};
- graph.d3Force("charge").strength(-100);
-
- window.addEventListener("resize", function () {
+ const resize = () => {
graph.renderer().setSize(window.innerWidth, window.innerHeight);
graph.camera().aspect = window.innerWidth / window.innerHeight;
graph.camera().updateProjectionMatrix();
- });
+ };
+
+ graph.d3Force("charge").strength(-100);
+
+ window.addEventListener("resize", resize);
// camera orbit
initialZoom();
return {
onSelect: handleSelect,
+ onLoad: resize,
};
// stars();
}