Skip to content

view: graph: Implement gtk::Scrollable and do not render content outside the displayed area

Tom Wagner requested to merge ryuukyu/helvum-dev:graphview-scrollable into main

The graphview widget now implements the gtk::Scrollable interface, so it is no longer wrapped inside a gtk::Viewport when used in a gtk::ScrollWindow anymore. Instead, it repositions its content itself when scrolled, and also skips rendering any content that is not inside the visible area, which should improve performance when the graph becomes big.

This is required for !30 (merged), as performance without these optimizations and high zoom levels is simply bad.

This commit also makes the canvas a fixed size as suggested in #30, with much space to each side from the starting area. This will hopefully improve user experience, as the view can now be moved around more freely, and nodes can be dragged left and above the starting area.

It's a little easy to "get lost" with the entire graph outside view with this change, but future MRs (zooming out, minimap) should improve this.

At the moment, the background does not scroll with the graph, so I'd like to try to fix that too before merging this, but it's not a big problem.

Edited by Tom Wagner

Merge request reports

Loading