Skip to content

Tooltips show up in wrong position #322

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

Open
tksuoran opened this issue Mar 20, 2025 · 1 comment
Open

Tooltips show up in wrong position #322

tksuoran opened this issue Mar 20, 2025 · 1 comment

Comments

@tksuoran
Copy link

tksuoran commented Mar 20, 2025

Tooltips in node editor show up in wrong position.

Repro:

diff --git a/examples/basic-interaction-example/basic-interaction-example.cpp b/examples/basic-interaction-example/basic-interaction-example.cpp
index 4253533..7cc8991 100644
--- a/examples/basic-interaction-example/basic-interaction-example.cpp
+++ b/examples/basic-interaction-example/basic-interaction-example.cpp
@@ -77,6 +77,7 @@ struct Example:
             ed::SetNodePosition(nodeA_Id, ImVec2(10, 10));
         ed::BeginNode(nodeA_Id);
             ImGui::Text("Node A");
+            if (ImGui::IsItemHovered()) ImGui::SetTooltip("Node A Tooltip");
             ed::BeginPin(nodeA_InputPinId, ed::PinKind::Input);
                 ImGui::Text("-> In");
             ed::EndPin();

When I hover over the Node A, the tooltip shows up near top left window corner, instead on top of the node.

I guess this has to do with Canvas vs. Screen coordinate systems. What would I need to do to make tooltips work better?

Edit: I am in docking branch I have these:

#define IMGUI_VERSION       "1.91.9"
#define IMGUI_VERSION_NUM   19190
#define IMGUI_HAS_TABLE
#define IMGUI_HAS_VIEWPORT          // Viewport WIP branch
#define IMGUI_HAS_DOCK              // Docking WIP branch
@tksuoran tksuoran changed the title Tooltips shows up in wrong position Tooltips show up in wrong position Mar 20, 2025
@tksuoran
Copy link
Author

tksuoran commented Apr 7, 2025

Workaround is to surround ImGui::SetTooltip() with Suspend() and Resume(). While this works for simple cases like SetTooltip(), I have not yet figured how to make more complex cases like ImGui::BeginCombo() to work.

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

1 participant