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

bug: parent.w does'nt take in account flex-grow #120

Open
1 task done
ascpial opened this issue Aug 25, 2024 · 2 comments · May be fixed by #121
Open
1 task done

bug: parent.w does'nt take in account flex-grow #120

ascpial opened this issue Aug 25, 2024 · 2 comments · May be fixed by #121
Labels
bug Something isn't working

Comments

@ascpial
Copy link

ascpial commented Aug 25, 2024

Describe the bug

When an object is marked in a flexbox with flexgrow, the children of that object will not update parent.w accordingly.

To Reproduce

Steps to reproduce the behavior:
Launch the code:

local basalt = require("basalt")

local main = basalt.createFrame()

local flex = main:addFlexbox()
    :setDirection("row"):setWrap("wrap")
    :setSize("parent.w-2", "parent.h-2")
    :setPosition(2, 2)
    :setBackground(false)

local subframe = flex:addFrame():setSize(20, 5)
    :setFlexBasis(20):setFlexGrow(1)
    :setBackground(colors.white)
subframe:addLabel():setText("A"):setPosition("parent.w", 2):setTextAlign("right"):setForeground(colors.gray)

basalt.autoUpdate()

Actual behaviour

Expected behavior

The A label should align at the right of the parent

Excpected behaviour

Checklist

  • I am running the latest version.
@ascpial ascpial added the bug Something isn't working label Aug 25, 2024
@ascpial
Copy link
Author

ascpial commented Aug 25, 2024

Note: this breaks an example in the documentation

Expected:
image

Reality:
image

@ascpial
Copy link
Author

ascpial commented Aug 25, 2024

I believe this bug has been introduced by this commit.

In the child function, :getSize() and other getters should return by default the base width and height.

@ascpial ascpial linked a pull request Aug 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant