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

Flexbox: pass correct cross-axis available space when computing an item's intrinsic main size (+misc fixes) #522

Merged
merged 5 commits into from
Aug 7, 2023

Conversation

nicoburns
Copy link
Collaborator

Objective

Changes made

bevyengine/bevy#9350 turned out to be caused by a number of separate issues:

  • Cross-axis available space was not being passed correctly when computing a Flexbox item's intrinsic main size.

^ this is the bug that is most directly related to the reported bevy bug. However, the supplied test case also revealed:

  • The stretch-alignment size was wrongly subtracting the parent node's margin rather than the child node's margin
  • Leaf nodes were not taking their margins into account when supplying available_space to their children

Feedback wanted

Popping this up now as I've reached a natural pause and it does actually fix the bevy issue, but arguably this ought to be three separate PRs and the "reduced" test cases ought to be renamed to something more descriptive. I would be interested in whether others consider this important / worthwhile.

@nicoburns nicoburns added the bug Something isn't working label Aug 6, 2023
@nicoburns nicoburns added this to the 0.3.13 milestone Aug 6, 2023
@nicoburns nicoburns changed the title Flexbocx: pass correct cross-axis available space when computing an item's intrinsic main size (+misc fixes) Flexbox: pass correct cross-axis available space when computing an item's intrinsic main size (+misc fixes) Aug 6, 2023
Copy link
Collaborator

@TimJentzsch TimJentzsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me to merge these fixes, even if the original Bevy issue is not fixed.

@nicoburns
Copy link
Collaborator Author

Seems reasonable to me to merge these fixes, even if the original Bevy issue is not fixed.

To be clear: this PR does fix the original Bevy issue. It just also includes some fixes that are only tangentially related to that issue.

@alice-i-cecile alice-i-cecile merged commit dab541d into main Aug 7, 2023
16 checks passed
@alice-i-cecile alice-i-cecile deleted the bevy_issue_9530 branch August 7, 2023 22:01
nicoburns added a commit that referenced this pull request Aug 13, 2023
…em's intrinsic main size (+misc fixes) (#522)

* Add tests for bevyengine/bevy#9350

* Pass accurate cross-axis available space when computing a flexbox item's intrinsic main size

* Subtract child margin not parent margin when computing stretch-alignment known size

* Add extra debug logs to flexbox algorithm

* Apply margins to leaf nodes when computing available space for measure functions

(cherry picked from commit dab541d)
nicoburns added a commit that referenced this pull request Aug 13, 2023
…em's intrinsic main size (+misc fixes) (#522)

* Add tests for bevyengine/bevy#9350

* Pass accurate cross-axis available space when computing a flexbox item's intrinsic main size

* Subtract child margin not parent margin when computing stretch-alignment known size

* Add extra debug logs to flexbox algorithm

* Apply margins to leaf nodes when computing available space for measure functions

(cherry picked from commit dab541d)
nicoburns added a commit that referenced this pull request Aug 13, 2023
…em's intrinsic main size (+misc fixes) (#522)

* Add tests for bevyengine/bevy#9350

* Pass accurate cross-axis available space when computing a flexbox item's intrinsic main size

* Subtract child margin not parent margin when computing stretch-alignment known size

* Add extra debug logs to flexbox algorithm

* Apply margins to leaf nodes when computing available space for measure functions

(cherry picked from commit dab541d)
nicoburns added a commit that referenced this pull request Aug 14, 2023
…em's intrinsic main size (+misc fixes) (#522)

* Add tests for bevyengine/bevy#9350

* Pass accurate cross-axis available space when computing a flexbox item's intrinsic main size

* Subtract child margin not parent margin when computing stretch-alignment known size

* Add extra debug logs to flexbox algorithm

* Apply margins to leaf nodes when computing available space for measure functions

(cherry picked from commit dab541d)
nicoburns added a commit that referenced this pull request Aug 14, 2023
…em's intrinsic main size (+misc fixes) (#522)

* Add tests for bevyengine/bevy#9350

* Pass accurate cross-axis available space when computing a flexbox item's intrinsic main size

* Subtract child margin not parent margin when computing stretch-alignment known size

* Add extra debug logs to flexbox algorithm

* Apply margins to leaf nodes when computing available space for measure functions

(cherry picked from commit dab541d)
nicoburns added a commit that referenced this pull request Aug 14, 2023
…em's intrinsic main size (+misc fixes) (#522)

* Add tests for bevyengine/bevy#9350

* Pass accurate cross-axis available space when computing a flexbox item's intrinsic main size

* Subtract child margin not parent margin when computing stretch-alignment known size

* Add extra debug logs to flexbox algorithm

* Apply margins to leaf nodes when computing available space for measure functions

(cherry picked from commit dab541d)
nicoburns added a commit that referenced this pull request Aug 14, 2023
…em's intrinsic main size (+misc fixes) (#522)

* Add tests for bevyengine/bevy#9350

* Pass accurate cross-axis available space when computing a flexbox item's intrinsic main size

* Subtract child margin not parent margin when computing stretch-alignment known size

* Add extra debug logs to flexbox algorithm

* Apply margins to leaf nodes when computing available space for measure functions

(cherry picked from commit dab541d)
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 this pull request may close these issues.

Invalid node size calculation for text + flex_grow: 1.0
3 participants