ScrollView viewport-width and viewport-height are not calculated automatically
Bug Description
The documentation for ScrollView states
The viewport-width and viewport-height are calculated automatically to create a scrollable view except for when using a for loop to populate the elements.
So, I copy pasted the example given, and commented out the vieweport-width and height - and it did not calculate automatically. It did not have scrollbars, instead just being a 200 x 200 square.
Expected outcome is that it know that the farthest rectangle is at x: 247px + 30px width/height and creates a view for that.
Reproducible Code (if applicable)
import { ScrollView } from "std-widgets.slint";
export component Example inherits Window {
width: 200px;
height: 200px;
ScrollView {
width: 200px;
height: 200px;
// viewport-width: 300px;
// viewport-height: 300px;
Rectangle { width: 30px; height: 30px; x: 275px; y: 50px; background: blue; }
Rectangle { width: 30px; height: 30px; x: 175px; y: 130px; background: red; }
Rectangle { width: 30px; height: 30px; x: 25px; y: 210px; background: yellow; }
Rectangle { width: 30px; height: 30px; x: 98px; y: 55px; background: orange; }
}
}
Environment Details
- Slint Version: 1.14.1
- Platform/OS: Linux, EndeavourOS (Arch Based)
- Programming Language: Rust
- Backend/Renderer: winit, I think?
Product Impact
Not sure. Probably not super critical since you can calculate the view-port sizing yourself in code, which you already have to do when using many elements in for loops anyway.
Thanks for filing a bug report. You're right, the documentation was not accurate. I have rewritten the documentation to match the actual behavior.
Now, it's true that it would be nice if it could be actually calculated automatically without layout as well. So I'll keep this issue open as a feature request.