Skip to content

ScrollView viewport-width and viewport-height are not calculated automatically #10185

@Gremious

Description

@Gremious

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.

Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:layoutsRelated to the layouting and positioning of the elements (mO,bT)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions