Browse Source

TabBar: Fixed Tab tooltip code making drag and drop tooltip disappear during the frame where the drag payload activate a tab.

omar 6 years ago
parent
commit
99d8425173
2 changed files with 4 additions and 1 deletions
  1. 2 0
      docs/CHANGELOG.txt
  2. 2 1
      imgui_widgets.cpp

+ 2 - 0
docs/CHANGELOG.txt

@@ -75,6 +75,8 @@ Other Changes:
   hard crashes any more, facilitating integration with scripting languages. (#1651)
   hard crashes any more, facilitating integration with scripting languages. (#1651)
 - TabBar: Fixed ImGuiTabItemFlags_SetSelected being ignored if the tab is not visible (with
 - TabBar: Fixed ImGuiTabItemFlags_SetSelected being ignored if the tab is not visible (with
   scrolling policy enabled) or if is currently appearing.
   scrolling policy enabled) or if is currently appearing.
+- TabBar: Fixed Tab tooltip code making drag and drop tooltip disappear during the frame where
+  the drag payload activate a tab.
 - Text: Fixed large Text/TextUnformatted call not declaring its size when starting below the
 - Text: Fixed large Text/TextUnformatted call not declaring its size when starting below the
   lower point of the current clipping rectangle. Somehow this bug has been there since v1.0!
   lower point of the current clipping rectangle. Somehow this bug has been there since v1.0!
   It was hardly noticeable but would affect the scrolling range, which in turn would affect
   It was hardly noticeable but would affect the scrolling range, which in turn would affect

+ 2 - 1
imgui_widgets.cpp

@@ -6779,7 +6779,8 @@ bool    ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open,
     window->DC.CursorPos = backup_main_cursor_pos;
     window->DC.CursorPos = backup_main_cursor_pos;
 
 
     // Tooltip (FIXME: Won't work over the close button because ItemOverlap systems messes up with HoveredIdTimer)
     // Tooltip (FIXME: Won't work over the close button because ItemOverlap systems messes up with HoveredIdTimer)
-    if (g.HoveredId == id && !held && g.HoveredIdNotActiveTimer > 0.50f)
+    // We test IsItemHovered() to discard e.g. when another item is active or drag and drop over the tab bar (which g.HoveredId ignores)
+    if (g.HoveredId == id && !held && g.HoveredIdNotActiveTimer > 0.50f && IsItemHovered())
         if (!(tab_bar->Flags & ImGuiTabBarFlags_NoTooltip))
         if (!(tab_bar->Flags & ImGuiTabBarFlags_NoTooltip))
             SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label);
             SetTooltip("%.*s", (int)(FindRenderedTextEnd(label) - label), label);