mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 03:58:47 +02:00
Drag and Drop: Fixed submitting a tooltip from drop target location. Added demo.
Amend7bbf8f2
,92b7d6b
.
This commit is contained in:
17
imgui.cpp
17
imgui.cpp
@ -12403,6 +12403,14 @@ void ImGui::ClearDragDrop()
|
||||
memset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal));
|
||||
}
|
||||
|
||||
bool ImGui::BeginTooltipHidden()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
bool ret = Begin("##Tooltip_Hidden", NULL, ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize);
|
||||
SetWindowHiddendAndSkipItemsForCurrentFrame(g.CurrentWindow);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// When this returns true you need to: a) call SetDragDropPayload() exactly once, b) you may render the payload visual/description, c) call EndDragDropSource()
|
||||
// If the item has an identifier:
|
||||
// - This assume/require the item to be activated (typically via ButtonBehavior).
|
||||
@ -12505,12 +12513,13 @@ bool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags)
|
||||
{
|
||||
// Target can request the Source to not display its tooltip (we use a dedicated flag to make this request explicit)
|
||||
// We unfortunately can't just modify the source flags and skip the call to BeginTooltip, as caller may be emitting contents.
|
||||
bool ret = BeginTooltip();
|
||||
bool ret;
|
||||
if (g.DragDropAcceptIdPrev && (g.DragDropAcceptFlags & ImGuiDragDropFlags_AcceptNoPreviewTooltip))
|
||||
ret = BeginTooltipHidden();
|
||||
else
|
||||
ret = BeginTooltip();
|
||||
IM_ASSERT(ret); // FIXME-NEWBEGIN: If this ever becomes false, we need to Begin("##Hidden", NULL, ImGuiWindowFlags_NoSavedSettings) + SetWindowHiddendAndSkipItemsForCurrentFrame().
|
||||
IM_UNUSED(ret);
|
||||
|
||||
if (g.DragDropAcceptIdPrev && (g.DragDropAcceptFlags & ImGuiDragDropFlags_AcceptNoPreviewTooltip))
|
||||
SetWindowHiddendAndSkipItemsForCurrentFrame(g.CurrentWindow);
|
||||
}
|
||||
|
||||
if (!(flags & ImGuiDragDropFlags_SourceNoDisableHover) && !(flags & ImGuiDragDropFlags_SourceExtern))
|
||||
|
Reference in New Issue
Block a user