Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component with visible: false still takes layout space #7377

Open
jmEvoqua opened this issue Jan 15, 2025 · 0 comments
Open

Component with visible: false still takes layout space #7377

jmEvoqua opened this issue Jan 15, 2025 · 0 comments
Labels
bug Something isn't working need triaging Issue that the owner of the area still need to triage

Comments

@jmEvoqua
Copy link

jmEvoqua commented Jan 15, 2025

Bug Description

If I understand the docs correctly, then an element with visible: false should not take any space in a layout?

When an element has 0 opacity it will still take up layout space and any gesture handling will continue to work. If the intent is to hide an element so it has no gesture handling or no longer takes up layout space, use the visible property instead.

https://docs.slint.dev/latest/docs/slint/reference/common/#opacity

But this seems not to be the case. The element still takes its space in the layout. Even if the size is 0px it counts as extra element, which causes extra spacing, if defined in the layout.

Reproducible Code (if applicable)

export component Demo {
    VerticalLayout {
        spacing: 20px;
        Rectangle {
            width: 180px;
            height: 180px;
            background: #315afd;
            opacity: 0.5;
        }

        Rectangle {
            width: 180px;
            height: 180px;
            background: green;
            opacity: 0.5;
            visible: false;
        }

        Rectangle {
            width: 180px;
            height: 180px;
            background: green;
            opacity: 1;
            
        }
        Rectangle {
            width: 180px;
            height: 0px;
            background: green;
            opacity: 0.5;
            visible: false;
        }
    }
}

Environment Details

  • Slint Version: 1.9.1

Product Impact

No response

@jmEvoqua jmEvoqua added bug Something isn't working need triaging Issue that the owner of the area still need to triage labels Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need triaging Issue that the owner of the area still need to triage
Projects
None yet
Development

No branches or pull requests

1 participant