wisp-forest / owo-lib

Open ωorthωhile Operations, yes the acronym was "totally accidental"
https://modrinth.com/mod/owo-lib
MIT License
191 stars 37 forks source link

[owo-ui] Sizing with 'extend' considers the 'gap' of FlowLayout as free space #219

Closed Zailer43 closed 6 months ago

Zailer43 commented 7 months ago

Description

When using a FlowLayout with a gap, if one of the components within it uses sizing with the 'extend' method, it will detect the gap as empty, causing the component to become too large. This doesn't happen if margins are used instead of a gap.

Code

<!-- expand + gap, bug -->
<flow-layout direction="horizontal">
    <children>
        <flow-layout direction="vertical">
            <children>
                <!-- ... -->
            </children>

            <sizing>
                <vertical method="fixed">20</vertical>
                <horizontal method="fixed">20</horizontal>
            </sizing>

            <surface>
                <panel/>
            </surface>
        </flow-layout>

        <flow-layout direction="vertical">
            <children>
                <!-- ... -->
            </children>

            <sizing>
                <vertical method="fixed">20</vertical>
                <horizontal method="expand">100</horizontal>
            </sizing>

            <surface>
                <panel/>
            </surface>
        </flow-layout>
    </children>

    <gap>10</gap>
</flow-layout>

<!-- margins -->
<flow-layout direction="horizontal">
    <children>
        <flow-layout direction="vertical">
            <children>
                <!-- ... -->
            </children>

            <sizing>
                <vertical method="fixed">20</vertical>
                <horizontal method="fixed">20</horizontal>
            </sizing>

            <surface>
                <panel/>
            </surface>

            <margins>
                <right>10</right>
            </margins>
        </flow-layout>

        <flow-layout direction="vertical">
            <children>
                <!-- ... -->
            </children>

            <sizing>
                <vertical method="fixed">20</vertical>
                <horizontal method="expand">100</horizontal>
            </sizing>

            <surface>
                <panel/>
            </surface>
        </flow-layout>
    </children>
</flow-layout>

Versions

owo_version=0.12.5+1.20.3 minecraft_version=1.20.4 fabric_version=0.96.4+1.20.4

gliscowo commented 6 months ago

Fixed in 0.12.6, thanks for reporting!

Cheers