nabil6391 / graphview

Flutter GraphView is used to display data in graph structures. It can display Tree layout, Directed and Layered graph. Useful for Family Tree, Hierarchy View.
MIT License
420 stars 114 forks source link

Possible error in NodeCluster.offset() method in NodeCluster class. #27

Closed SteveLamont closed 3 years ago

SteveLamont commented 3 years ago

It looks to me as if there is an error in setting the offset of the rect property in the offset() method in the NodeCluster class.

The code currently reads

    nodes.forEach((node) {
      node.position = (node.position + Offset(xDiff, yDiff));
    });

    rect.translate(xDiff, yDiff);
  }

This, I suggest, is incorrect as the translate() method of the Dart Rect object returns a new Rect object, not modifying the original Rect.

Thus, I believe the code should read


    nodes.forEach((node) {
      node.position = (node.position + Offset(xDiff, yDiff));
    });

    rect = rect.translate(xDiff, yDiff);

  }
nabil6391 commented 3 years ago

Thanks, I will have a look.

SteveLamont commented 3 years ago

Any ETA on a fix for this?

Thanx.

nabil6391 commented 3 years ago

@SteveLamont Its done. Fixed in 0.6.7 . Was it causing any significant problem for you

SteveLamont commented 3 years ago

Thanx for the fix.

Yes, when multiple node clusters were present, they would be be positioned badly.