ericdrowell/ElGrapho

Viewport should support rescaling

Closed this issue · 3 comments

I'd like to fill the browser window (or an auto-scaled flexbox div within it) and have the graph render resize itself. At the moment I have to tear the whole thing down and start again.

I guess supporting this in a nicer way (e.g. I edit the width and height properties on the model and call Redraw()) is a little complex, as all the layouts probably need a recompute from scratch?

totally agree. I will look into this and try to have a solution this weekend.

wanted to give an update on this - in the next version, 2.3.0, you will be able to call graph.setSize(width, height) at any moment to resize the graph visualization. Setting the graph size has no perf implications - the model does not change, and the vertices already in the GPU do not change. Note however, that in 2.3.0, when instantiating a graph, the width and height properties have been moved to the root level of the config. Once released, please see the updated docs.

Also, added fillContainer property which makes El Grapho constantly keep the graph viewport filling up its container. Here's a tweet with video: https://twitter.com/ericdrowell/status/1120070107298840576