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

Autowrap breaks button size. #99878

Open
viksl opened this issue Nov 30, 2024 · 1 comment
Open

Autowrap breaks button size. #99878

viksl opened this issue Nov 30, 2024 · 1 comment

Comments

@viksl
Copy link
Contributor

viksl commented Nov 30, 2024

Tested versions

4.3

System information

Win 11, i513600kf, RTX 4070.

Issue description

When autowrap is set it breaks the size of buttons with Godot's automatic sizing in games as well as in plugins.
Video: https://youtu.be/f-Zi81_Ocsw

  1. Early in the video you can observe no issues when autowrap is disabled.
  2. In the video you can see that if you move slowly the buttons get properly resized but if you move quickly you can break it.
  3. In the second half you can watch the same issue with an Editor plugin I added which is automatically resized by Godot and not me which means it's not just an issue of moving mouse too quickly.

In the video everything had its custom size set for X, after the video I also set it to Y (with a more than enough of a value) - for the plugin part of the video the buttons as well as other elements have both X and Y minimum sizes set properly with enough buffers - but it still breaks.

(It breaks with any autowrap option other then Off)

Steps to reproduce

Add couple buttons, assign text to them which spans couple words so you can test the wrapping, to a HBoxContainer, set custom min sizes to buttons as well as the container, set the anchors and offset values to Left Wide then grab the HBoxContainer right side handle and move around to shrink/enlarge the box until you observe the issues as in the video, for comparison you can move slowly to see how it works properly or when broken you can change the custom min size to some value just barely above/below your so Godot automatically resizes everything correctly.

Second option, add an EditorPlugin as described above to the viewport, resize the viewport to make sure it doesn't span the entire viewport and then just got Project Settings - Plugins and enable and disable the plugin just like I did in the video, this way you can see how the size gets messed up, if you move the viewport handle then even by just a pixel it properly resizes again.

Minimal reproduction project (MRP)

AutoWrapMrp.zip

@JamesC01
Copy link

JamesC01 commented Dec 1, 2024

I'm also having issues with autowrap and button sizes, but it's a bit different. If I dynamically create a button (with autowrap on) and put it inside a VBoxContainer, if the text is more than one line, the text will flow outside of the button, but weirdly, if you hide and show the button, it fixes the size. But it has to be seen in game first before it will fix itself, so I've spent hours just trying to get it work correctly. Also on 4.3. It only seems to happen when the font is bigger than the default one, though.

But, I tested it in the latest 4.4 dev build, and it works fine! So at least my problem has been, fixed, maybe check to see if your issue has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants