Browse Source

Drag and Drop: Fix unintended fallback "..." tooltip during drag operation when drag source uses _SourceNoPreviewTooltip flags. (#3160)

Rokas Kupstys 5 years ago
parent
commit
2593b6a1c8
3 changed files with 5 additions and 2 deletions
  1. 3 1
      docs/CHANGELOG.txt
  2. 1 1
      imgui.cpp
  3. 1 0
      imgui.h

+ 3 - 1
docs/CHANGELOG.txt

@@ -49,8 +49,10 @@ Other Changes:
 - Backends: Win32: Support for #define NOGDI, won't try to call GetDeviceCaps(). (#3137, #2327)
 - Backends: Win32: Support for #define NOGDI, won't try to call GetDeviceCaps(). (#3137, #2327)
 - Backends: OpenGL: Fixed handling of GL 4.5+ glClipControl(GL_UPPER_LEFT) by inverting the
 - Backends: OpenGL: Fixed handling of GL 4.5+ glClipControl(GL_UPPER_LEFT) by inverting the
   projection matrix top and bottom values. (#3143, #3146) [@u3shit]
   projection matrix top and bottom values. (#3143, #3146) [@u3shit]
-- Backends: Vulkan: Fixed edge case where render callbacks wouldn't be called if the ImDrawData 
+- Backends: Vulkan: Fixed edge case where render callbacks wouldn't be called if the ImDrawData
   structure didn't have any vertices. (#2697) [@kudaba]
   structure didn't have any vertices. (#2697) [@kudaba]
+- Drag and Drop: Fixed unintended fallback "..." tooltip display during drag operation when
+  drag source uses _SourceNoPreviewTooltip flags. (#3160) [@rokups]
 
 
 
 
 -----------------------------------------------------------------------
 -----------------------------------------------------------------------

+ 1 - 1
imgui.cpp

@@ -4216,7 +4216,7 @@ void ImGui::EndFrame()
     }
     }
 
 
     // Drag and Drop: Fallback for source tooltip. This is not ideal but better than nothing.
     // Drag and Drop: Fallback for source tooltip. This is not ideal but better than nothing.
-    if (g.DragDropActive && g.DragDropSourceFrameCount < g.FrameCount)
+    if (g.DragDropActive && g.DragDropSourceFrameCount < g.FrameCount && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoPreviewTooltip))
     {
     {
         g.DragDropWithinSource = true;
         g.DragDropWithinSource = true;
         SetTooltip("...");
         SetTooltip("...");

+ 1 - 0
imgui.h

@@ -644,6 +644,7 @@ namespace ImGui
 
 
     // Drag and Drop
     // Drag and Drop
     // - [BETA API] API may evolve!
     // - [BETA API] API may evolve!
+    // - If you stop calling BeginDragDropSource() the payload is preserved however it won't have a preview tooltip (we currently display a fallback "..." tooltip as replacement)
     IMGUI_API bool          BeginDragDropSource(ImGuiDragDropFlags flags = 0);                                      // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()
     IMGUI_API bool          BeginDragDropSource(ImGuiDragDropFlags flags = 0);                                      // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()
     IMGUI_API bool          SetDragDropPayload(const char* type, const void* data, size_t sz, ImGuiCond cond = 0);  // type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
     IMGUI_API bool          SetDragDropPayload(const char* type, const void* data, size_t sz, ImGuiCond cond = 0);  // type is a user defined string of maximum 32 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.
     IMGUI_API void          EndDragDropSource();                                                                    // only call EndDragDropSource() if BeginDragDropSource() returns true!
     IMGUI_API void          EndDragDropSource();                                                                    // only call EndDragDropSource() if BeginDragDropSource() returns true!