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

Item-tooltip for text will disappear for a short time the text get resized #7945

Closed
achabense opened this issue Sep 3, 2024 · 1 comment
Closed
Labels

Comments

@achabense
Copy link

Version/Branch of Dear ImGui:

Version 1.90.9

Back-ends:

imgui_impl_sdl2.cpp + imgui_impl_sdlrenderer2.cpp

Compiler, OS:

Windows 10 + MSVC 2022

Full config/build information:

No response

Details:

When the text get resized, IsItemHovered(ImGuiHoveredFlags_ForTooltip) for the text will become 0, even if the mouse remains hovering on the resized one. This can make the tooltip (based on BeginItemTooltip) for the text disappear for a very short time, which I think is not ideal behavior.

Screenshots/Video:

(The tooltip will disappear for a short time when pressing 'Z'.)
issue

Minimal, Complete and Verifiable Example code:

void issue() {
    if (ImGui::Begin("Issue", 0, ImGuiWindowFlags_NoSavedSettings)) {
        static bool i = 0;
        if (ImGui::IsKeyPressed(ImGuiKey_Z)) {
            i = !i;
        }

        ImGui::Text(i ? "ABCDEFG" : "ABCD");
        if (ImGui::BeginItemTooltip()) {
            ImGui::Text("...");
            ImGui::EndTooltip();
        }
        // Will become 0 when the text is resized:
        ImGui::Text("%d", int(ImGui::IsItemHovered(ImGuiHoveredFlags_ForTooltip)));
    }
    ImGui::End();
}
ocornut added a commit that referenced this issue Sep 3, 2024
…implicit ID using Pos only. (#7945, #1485, #143)

Perhaps a better approach would be to: store last non-zero ID + count successive zero ID and combine then.
@ocornut
Copy link
Owner

ocornut commented Sep 3, 2024

Thank you for the working repro, this is helpful.

I have pushed a fix as f99febf. I think we may end revisiting this by reworking how we create implicit id for e.g. Text() by using counters, this may apply to drag and drop sources as well.

@ocornut ocornut closed this as completed Sep 3, 2024
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

3 participants
@ocornut @achabense and others