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

ImGui::BeginPopup being cropped at first open #8198

Open
eduardodoria opened this issue Dec 1, 2024 · 2 comments
Open

ImGui::BeginPopup being cropped at first open #8198

eduardodoria opened this issue Dec 1, 2024 · 2 comments

Comments

@eduardodoria
Copy link

Version/Branch of Dear ImGui:

Version 1.91.5, Branch: docking

Back-ends:

imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp

Compiler, OS:

Linux + GCC

Full config/build information:

No response

Details:

When I open a popup with a table inside, at first time it has been cropped but next times its is ok.

I can fix this behavior adding ImGui::SetNextWindowSizeConstraints(ImVec2(400, 0), ImVec2(FLT_MAX, FLT_MAX)); before ImGui::BeginPopup but it is not good because the size of the table inside popup will vary.

I think popup not know its size before first open. Is this the correct behavior or a bug?

Screenshots/Video:

Gravacao.de.tela.de.2024-12-01.11-51-14.webm

Minimal, Complete and Verifiable Example code:

if (ImGui::Button(ICON_FA_GEAR)){
    ImGui::OpenPopup(("menusettings_"+prop.name).c_str());
}
//ImGui::SetNextWindowSizeConstraints(ImVec2(400, 0), ImVec2(FLT_MAX, FLT_MAX));
if (ImGui::BeginPopup(("menusettings_"+prop.name).c_str())){
    ImGui::Text("%s settings", prop.label.c_str());
    ImGui::Separator();

    drawPropertiesTable(cpType, prop.childs, scene, entity, "_child_"+prop.name, 200);

    ImGui::EndPopup();
}
@eduardodoria eduardodoria changed the title ImGui::BeginPopu being cropped at first open ImGui::BeginPopup being cropped at first open Dec 1, 2024
@ocornut
Copy link
Owner

ocornut commented Dec 2, 2024

We are missing too many details to provide guidance.

  • Why in the second open the popup is moved to the left? Is the dark window an actual platform/os window? What's the left and right of it?

  • Can you confirm if the window is mis-sized or if it is cropped? IMGUI_DEBUG_LOG("%f %f\n", ImGui::GetWindowSize().x, ImGui::GetWindowSize().y); would work. You can see additional details in Metrics/Debugger.

@eduardodoria
Copy link
Author

Why in the second open the popup is moved to the left? Is the dark window an actual platform/os window? What's the left and right of it?

A better video here opening tree times:
Gravação de tela de 2024-12-03 14-12-42.webm

Can you confirm if the window is mis-sized or if it is cropped? IMGUI_DEBUG_LOG("%f %f\n", ImGui::GetWindowSize().x, ImGui::GetWindowSize().y); would work. You can see additional details in Metrics/Debugger.

(first open)
16.000000 16.000000
122.000000 144.000000
289.000000 144.000000
289.000000 144.000000
289.000000 144.000000
[...]
(second open)
16.000000 16.000000
289.000000 144.000000
289.000000 144.000000
289.000000 144.000000
[...]
(third open)
16.000000 16.000000
289.000000 144.000000
289.000000 144.000000
[...]

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

2 participants