diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-10-06 15:27:31 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-10-06 15:27:31 +0200 |
| commit | 77cfa255274fdcdf822e836c7ea98e769bcb865d (patch) | |
| tree | 872e272eaeeacb0c48724826b14fed2bdd11e093 /src/graph.js | |
| parent | 995c5c4b3769f8402092aba1777d29ebcc259230 (diff) | |
mobile
Diffstat (limited to 'src/graph.js')
| -rw-r--r-- | src/graph.js | 11 |
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(); } |
