Have Scrollable size influence its content size

I want to draw a plot using a Canvas widget and have it be horizontally scrollable inside a Scrollable. Additionally there is a zoom slider which essentially sets the width of the canvas to adjust the horizontal resolution of the plot. This works fine except for the fact that, depending on the window size, the plot can become smaller than the scrollable viewport which I want to avoid.

In order to do that I would need the canvas to know the concrete size of its parent scrollable to limit the zoom range. How could this be accomplished? I thought about setting the size in a RefCell from the viewport that is provided to the Widget::draw implementation of Canvas, but that is obviously not ideal.

I have decided that it’s best to handle the scrolling manually in the canvas::Program::update method. That way I can also fully customize the scrollbar.