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] Some dropdowns failing to open or stay open #2769

Open
ZeitHeld opened this issue Apr 28, 2023 · 9 comments
Open

[ImGui] Some dropdowns failing to open or stay open #2769

ZeitHeld opened this issue Apr 28, 2023 · 9 comments

Comments

@ZeitHeld
Copy link

Whenever I press on the drop down menu for the chest texture, to select an option, it immediately disappears again.
It only happens there for any reason

@jbodner09
Copy link
Contributor

I did a little experimenting with the code, and there's no obvious thing wrong with it like misuse of the widget or something else using the cvar incorrectly. What's interesting is that I occasionally did get it to stay open, but the other times, the arrow stayed highlighted like it knew it was supposed to be open but just wasn't. I'm not sure how up to date our imgui code is, but I don't want to rule out the bug being on them.

@ZeitHeld
Copy link
Author

ZeitHeld commented Apr 30, 2023 via email

@ZeitHeld
Copy link
Author

I found out something new about it, which is, that it DOES work, but only when clicking on the left most part of it. Otherwise, it flickers.

@Malkierian
Copy link
Contributor

https://mega.nz/file/ftYy3IDK#atR4SeOclBc_ApFK9idYqeMJJQmypnyJvAMY7jBz3yA

Was told to post here and close my other one. It seems, especially with the nested menus, dropdowns on those menus fail to open or stay open when clicked if their submenu is not fully on or off of the game screen.

@briaguya-ai
Copy link
Contributor

briaguya-ai commented Dec 19, 2024

it seems the issue name here is quite misleading, i think "tooltips/dropdowns that go outside the main window cause menus to close" or something similar would better describe it

edit: i went ahead and changed the name to be the more descriptive one that was closed in favor of this one

that is assuming this issue is the same as what i experienced here

Screencast.From.2024-12-19.13-01-09.mp4

this feels to me like either us misusing imgui or a problem with imgui's docking branch itself. i think good next steps here would be to:

  • try updating to the latest released version of docking imgui
    • if that fixes it awesome, we're done!
  • if latest docking imgui doesn't fix it, make a minimal repro example (based on examples in the imgui repo) and make an issue over there

@briaguya-ai briaguya-ai changed the title Unable to Enable chests contents matching texture [ImGui] Some dropdowns failing to open or stay open Dec 19, 2024
@Malkierian
Copy link
Contributor

The only real way to test if it's a problem with the docker fork would be to have an example done on the main repo. I get the feeling it's just a general ImGui issue. But yes, your video is likely the same issue.

@briaguya-ai
Copy link
Contributor

docking is just a branch on the main repo - not a fork. an issue with that branch can be created on the main upstream imgui repo assuming someone can put a minimal repro together

i still think just bumping the version we use is the best first step though

@briaguya-ai
Copy link
Contributor

tested 1.91.6 with #4738, the issue is still there

@briaguya-ai
Copy link
Contributor

briaguya-ai commented Dec 19, 2024

edit: was able to make a minimal repro ocornut/imgui#8252

previous message

i tried to repro in the example app in imgui but wasn't able to - i tried this

briaguya@butterfly:~/code/imgui$ git diff
diff --git a/imgui_demo.cpp b/imgui_demo.cpp
index ed205011..d83d3dd8 100644
--- a/imgui_demo.cpp
+++ b/imgui_demo.cpp
@@ -8311,6 +8311,37 @@ static void ShowExampleAppMainMenuBar()
     {
         if (ImGui::BeginMenu("File"))
         {
+            // BEGIN MENU CLOSE ISSUE
+            static int val = 0;
+            ImGui::BeginGroup();
+            ImGui::Dummy(ImVec2(0.0f, 0));
+            
+            ImGui::BeginGroup();
+            if (true) {
+                if (ImGui::Button(" - ")) {}
+                ImGui::SameLine();
+                ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
+            }
+    
+            auto width = (ImGui::GetContentRegionAvail().x - 30.0f) < 260.0f ? (ImGui::GetContentRegionAvail().x - 30.0f) : 260.0f;
+            ImGui::PushItemWidth(width);
+            if (ImGui::SliderInt("###testslider", &val, 0, 10, "%d", ImGuiSliderFlags_AlwaysClamp)) {}
+            ImGui::PopItemWidth();
+            
+            if (true) {
+                ImGui::SameLine();
+                ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
+                if (ImGui::Button(" + ")) {}
+            }
+            ImGui::EndGroup();
+
+            ImGui::Dummy(ImVec2(0.0f, 0));
+            ImGui::EndGroup();
+            if (ImGui::IsItemHovered()) {
+                ImGui::SetTooltip("this is a really long tooltip that will overflow and go outside of the window space and hopefully reproduce the issue i was seeing before");
+            }
+
+            // END MENU CLOSE ISSUE
             ShowExampleMenuFile();
             ImGui::EndMenu();
         }

based on trying to replicate what the uiwidgets in

if (UIWidgets::PaddedEnhancementSliderInt(
(CVarGetInteger(CVAR_MSAA_VALUE, 1) == 1) ? "Anti-aliasing (MSAA): Off" : "Anti-aliasing (MSAA): %d",
"##IMSAA", CVAR_MSAA_VALUE, 1, 8, "", 1, true, true, false)) {
Ship::Context::GetInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger(CVAR_MSAA_VALUE, 1));
}
UIWidgets::Tooltip("Activates MSAA (multi-sample anti-aliasing) from 2x up to 8x, to smooth the edges of rendered geometry.\n"
"Higher sample count will result in smoother edges on models, but may reduce performance.\n\n"
"Recommended: 2x or 4x");

are doing

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

No branches or pull requests

4 participants