slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.64k stars 607 forks source link

Image element blocks resizing #6865

Open jmEvoqua opened 23 hours ago

jmEvoqua commented 23 hours ago

Bug Description

During refactoring I noticed that an image element blocks the resizing(stretching) in a layout. If I replace the image with an rectangle of the same size the resizing works as expected.

grafik

I expected a fixed sized image element to behave the same as a fixed sized rectangle:

grafik

What makes it even worse is that when the image is conditional, it works as expected. This makes it very hard to reason about the layout system.

if true: Image {

grafik

Reproducible Code (if applicable)

component Main inherits Window {

    HorizontalLayout {

        Rectangle {
            background: green;
        }

        Rectangle {
            background: red;

            Image {
                source: @image-url("https://slint.dev/logo/slint-logo-full-light.svg");
                colorize: white;
                width: 50px;
                height: 50px;

            }
        }
    }
}

Environment Details

Product Impact

This sort of bugs makes it hard to understand the (not so intuitive) layout system and requires additional time to find workarounds. The initial fast development speed is slowed down drastically when something odd in the layout happens.