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

LabelText resizes incorrectly with multiline text #4004

Closed
ptxmac opened this issue Apr 3, 2021 · 1 comment
Closed

LabelText resizes incorrectly with multiline text #4004

ptxmac opened this issue Apr 3, 2021 · 1 comment
Labels

Comments

@ptxmac
Copy link
Contributor

ptxmac commented Apr 3, 2021

Version/Branch of Dear ImGui:

Version: 1.8.3
Branch: master
Commit: 00d570e

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler: clang-1200.0.32.29
Operating System: macOS 11.2.3

My Issue/Question:

LabelText only resize its own height based on the label. If used with a value containing line breaks these will be clipped. (See 3rd row in the screenshot.

I would expect the sizing to be based on the biggest of the label and value texts

Screenshots/Video

image

Standalone, minimal, complete and verifiable example:

// Put this in any example program
ImGui::Begin("Multiline LabelText");
    ImGui::Separator();
    ImGui::LabelText("Single line label", "Single line text");
    ImGui::Separator();
    ImGui::LabelText("Multi\n line\n label", "Single line text");
    ImGui::Separator();
    ImGui::LabelText("Single line label", "Multi\n line\n text");
    ImGui::Separator();
    ImGui::LabelText("Single line label", "Single line text");
    ImGui::Separator();
ImGui::End();
@ocornut ocornut added the bug label Apr 6, 2021
ocornut added a commit that referenced this issue Apr 6, 2021
…ixed vertical alignment of single-line value text when label is multi-line. (#4004)
@ocornut
Copy link
Owner

ocornut commented Apr 6, 2021

Should be be fixed by c283a1d.
I also noticed from your picture that the second case is vertically centered with is inconsistent with other widgets so fixed that as well. Thank you!

image

@ocornut ocornut closed this as completed Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants