app: Correction centrage graphe changement taille

This commit is contained in:
Mattéo Delabre 2019-11-27 02:06:42 -05:00
parent 8f488a0cb3
commit c9f0e8c5ce
Signed by: matteo
GPG Key ID: AE3FBD02DC583ABB
1 changed files with 3 additions and 3 deletions

View File

@ -105,14 +105,14 @@ const Graph = ({nodes, edges, render}) =>
useEffect(() => useEffect(() =>
{ {
const center = new Springy.Vector( const center = () => new Springy.Vector(
window.innerWidth / 2, window.innerWidth / 2,
window.innerHeight / 2 window.innerHeight / 2
); );
const scale = 50; const scale = 50;
const coordsToScreen = vec => vec.multiply(scale).add(center); const coordsToScreen = vec => vec.multiply(scale).add(center());
const screenToCoords = vec => vec.subtract(center).divide(scale); const screenToCoords = vec => vec.subtract(center()).divide(scale);
layout.start(() => layout.start(() =>
{ {