app: Correction centrage graphe changement taille
This commit is contained in:
parent
8f488a0cb3
commit
c9f0e8c5ce
|
@ -105,14 +105,14 @@ const Graph = ({nodes, edges, render}) =>
|
|||
|
||||
useEffect(() =>
|
||||
{
|
||||
const center = new Springy.Vector(
|
||||
const center = () => new Springy.Vector(
|
||||
window.innerWidth / 2,
|
||||
window.innerHeight / 2
|
||||
);
|
||||
|
||||
const scale = 50;
|
||||
const coordsToScreen = vec => vec.multiply(scale).add(center);
|
||||
const screenToCoords = vec => vec.subtract(center).divide(scale);
|
||||
const coordsToScreen = vec => vec.multiply(scale).add(center());
|
||||
const screenToCoords = vec => vec.subtract(center()).divide(scale);
|
||||
|
||||
layout.start(() =>
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue