From f0575411c0137c3524fa40fad63d8eb24b8558ee Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 2 Oct 2024 15:23:54 +0200 Subject: [PATCH] Tooltips, Drag and Drop: Fixed an issue where the fallback drag and drop payload tooltip appeared during drag and drop release. E.g. it would otherwise appear when releasing a color button payload. --- docs/CHANGELOG.txt | 2 ++ imgui.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index db13bc9b1..f9fb75866 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -71,6 +71,8 @@ Other changes: - Scrollbar: Shift+Click scroll to clicked location (pre-1.90.8 default). (#8002, #7328) - Scrollbar: added io.ConfigScrollbarScrollByPage setting (default to true). (#8002, #7328) Set io.ConfigScrollbarScrollByPage=false to enforce always scrolling to clicked location. +- Tooltips, Drag and Drop: Fixed an issue where the fallback drag and drop payload tooltip + appeared during drag and drop release. - Backends: SDL3: Update for API changes: SDL_bool removal. SDL_INIT_TIMER removal. - Backends: WebGPU: Fixed DAWN api change using WGPUStringView in WGPUShaderSourceWGSL. (#8009, #8010) [@blitz-research] diff --git a/imgui.cpp b/imgui.cpp index 5f0c8281b..059a7ec56 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -5521,7 +5521,7 @@ void ImGui::EndFrame() // in the BeginDragDropSource() block of the dragged item, you can submit them from a safe single spot // (e.g. end of your item loop, or before EndFrame) by reading payload data. // In the typical case, the contents of drag tooltip should be possible to infer solely from payload data. - if (g.DragDropActive && g.DragDropSourceFrameCount < g.FrameCount && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoPreviewTooltip)) + if (g.DragDropActive && g.DragDropSourceFrameCount + 1 < g.FrameCount && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoPreviewTooltip)) { g.DragDropWithinSource = true; SetTooltip("...");