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

Invalid node size calculation for text + flex_grow: 1.0 #9350

Closed
jkb0o opened this issue Aug 3, 2023 · 4 comments · Fixed by DioxusLabs/taffy#522
Closed

Invalid node size calculation for text + flex_grow: 1.0 #9350

jkb0o opened this issue Aug 3, 2023 · 4 comments · Fixed by DioxusLabs/taffy#522
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior

Comments

@jkb0o
Copy link
Contributor

jkb0o commented Aug 3, 2023

Bevy version

v0.11.0

Relevant system information

Cargo:
cargo 1.71.0 (cfd3bbd8f 2023-06-08)
Adapter:
AdapterInfo { name: "Apple M2", vendor: 0, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Metal }
System:
SystemInfo { os: "MacOS 13.0 ", kernel: "22.1.0", cpu: "Apple M2", core_count: "8", memory: "16.0 GiB" }

What you did

I create multiple nodes with two flex_grow: 1 nodes (the first one is parent of the second one) and put some text inside the second node. On the video the center red node has flex_grow: 1, the center green node has flex_grow: 1 and the text added to the center green node.

What went wrong

When I try to resize the window, the center green node doesn't reduce the size to match the size of the text.

Additional information

Providing width to the center green node will fix the issue

bevy_flex_grow_bug.mov

There is the sample project:
bevy-issue-flex-grow.zip

@jkb0o jkb0o added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Aug 3, 2023
@ickshonpe
Copy link
Contributor

ickshonpe commented Aug 3, 2023

Looks like a bug in Taffy, since the text node is the correct size. The sample project works correctly if you replace the text node with a regular NodeBundle and a fixed size measure func.

@jkb0o jkb0o mentioned this issue Aug 4, 2023
15 tasks
@nicopap nicopap added A-UI Graphical user interfaces, styles, layouts, and widgets and removed S-Needs-Triage This issue needs to be labelled labels Aug 5, 2023
@nicoburns
Copy link
Contributor

I have been able to reproduce this as a Taffy gentest, so I can confirm that this is (most likely) a bug in Taffy. It seems to be using the min-content size for the text when it shouldn't be, or something like that.

nicoburns added a commit to DioxusLabs/taffy that referenced this issue Aug 6, 2023
nicoburns added a commit to DioxusLabs/taffy that referenced this issue Aug 6, 2023
nicoburns added a commit to DioxusLabs/taffy that referenced this issue Aug 6, 2023
nicoburns added a commit to DioxusLabs/taffy that referenced this issue Aug 6, 2023
nicoburns added a commit to DioxusLabs/taffy that referenced this issue Aug 6, 2023
alice-i-cecile pushed a commit to DioxusLabs/taffy that referenced this issue Aug 7, 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
nicoburns added a commit to DioxusLabs/taffy that referenced this issue 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 to DioxusLabs/taffy that referenced this issue 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 to DioxusLabs/taffy that referenced this issue 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 to DioxusLabs/taffy that referenced this issue 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 to DioxusLabs/taffy that referenced this issue 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 to DioxusLabs/taffy that referenced this issue 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 to DioxusLabs/taffy that referenced this issue 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
Copy link
Contributor

Taffy 0.3.13, which includes the fix for this issue has now been released. Please cargo update to obtain the fix :)

@jkb0o
Copy link
Contributor Author

jkb0o commented Aug 15, 2023

@nicoburns thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior
Projects
None yet
4 participants