moveNodes method

void moveNodes(
  1. Graph graph
)

Implementation

void moveNodes(Graph graph) {
  graph.nodes.forEach((node) {
    var newPosition = node.position += displacement[node]!;
    double newDX = min(graphWidth - 40, max(0, newPosition.dx));
    double newDY = min(graphHeight - 40, max(0, newPosition.dy));

    // double newDX = newPosition.dx;
    // double newDY = newPosition.dy;
    node.position = Offset(newDX, newDY);
  });
}