graphview icon indicating copy to clipboard operation
graphview copied to clipboard

Graph does not scale properly when first created

Open Quixotical opened this issue 2 years ago • 1 comments

When first creating a tree graph, I create the tree and it stays locked to the top left of the screen. Then I scale by 2 finger pinching, and it immediately snaps to take up all available space on the screen. I have not been able to find a way to fix this yet, and it makes things look a little unpolished if the graph starts looking smaller, then you pinch and it snaps to be a lot larger and it's placement moves on the screen

Expectation

The graph can start in the same position and as expanded as it will be after pinching screen when it is first created. Without this, the graph looks sort of hacked together.

Before pinching

Screenshot from 2022-03-02 19-33-48

After pinching

Screenshot from 2022-03-02 19-34-53

Conclusion

As you can see, the graph has moved to be centered and is much larger, even though I did the smallest amount of pinch scaling as possible (After this initial pinch scale, the scaling is smooth and it no longer moves the placement of the graph again)

Quixotical avatar Mar 02 '22 16:03 Quixotical

Here is an easy way to reproduce it: In the example https://github.com/nabil6391/graphview/blob/master/example/lib/tree_graphview.dart change level separation to 15 instead of 150. Run the demo app and it the graph will snap down after the first zoom gesture.

This bug seems to always occur, when the graph is smaller than the view. If the graph is larger then it works properly.

lischilpp avatar Jun 02 '23 19:06 lischilpp