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

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 commit also makes the canvas a fixed size, 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.
This commit is contained in:
Tom A. Wagner
2022-07-21 19:05:23 +02:00
parent 637ce104df
commit 4bf586e66c
2 changed files with 274 additions and 96 deletions

View File

@@ -18,7 +18,6 @@
@define-color audio rgb(50,100,240);
@define-color video rgb(200,200,0);
@define-color midi rgb(200,0,50);
@define-color graphview-grid rgb(35,35,35);
@define-color graphview-link #808080;
.audio {
@@ -37,8 +36,5 @@
}
graphview {
background-image: linear-gradient(@graphview-grid 1px, transparent 1px),
linear-gradient(to right, @graphview-grid 1px, transparent 1px);
background-size: 20px 20px;
background-color: @text_view_bg;
}