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

Drag&Drop rendering default tooltip "..." when ImGuiDragDropFlags_SourceNoPreviewTooltip | ImGuiDragDropFlags_SourceExtern are set #3160

Closed
dgregorius opened this issue Apr 24, 2020 · 1 comment
Labels
drag drop drag and drop

Comments

@dgregorius
Copy link

dgregorius commented Apr 24, 2020

Version/Branch of Dear ImGui:
Version: 17601
Branch: docking

Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler: VS 2019
Operating System: Windows 10

My Issue/Question:
I am implementing a simple animation graph and found that ImGui Drag&Drop is perfect to connect nodes with links. The code simply checks if the outer rim of the node was clicked and then creates a payload. I specify ImGuiDragDropFlags_SourceNoPreviewTooltip but still get a default preview from ImGui::EndFrame().

`if ( ImGui::IsItemClicked() )
{
const float Padding = 8.0f;
if ( !ImGui::Contains( NodeMin, NodeMax, ImGui::GetMousePos(), Padding ) )
{
if ( ImGui::BeginDragDropSource( ImGuiDragDropFlags_SourceNoPreviewTooltip | ImGuiDragDropFlags_SourceExtern ) )
{
ImVec2 NodeCenter = ( NodeMin + NodeMax ) / 2.0f;
ImGui::SetDragDropPayload( "TRANSITION", &NodeCenter, sizeof( NodeCenter ) );
ImGui::EndDragDropSource();
}
}

			State->Select();
			}`

This is where the tooltip is coming from. Not sure what it is checking for and if it should check a the tooltip flag

void ImGui::EndFrame()
{
[SNIP]

// Drag and Drop: Fallback for source tooltip. This is not ideal but better than nothing.
if (g.DragDropActive && g.DragDropSourceFrameCount < g.FrameCount)
{
    g.DragDropWithinSource = true;
    SetTooltip("...");
    g.DragDropWithinSource = false;
}

[SNIP]

}

Is this a bug or I am using anything wrong. I recall this was working for me this way before.

Thanks!
.

@ocornut ocornut added the drag drop drag and drop label Apr 26, 2020
rokups added a commit to rokups/imgui that referenced this issue Apr 27, 2020
…source uses _SourceExtern | _SourceNoPreviewTooltip flags. (ocornut#3160)
ocornut pushed a commit that referenced this issue Apr 27, 2020
…ation when drag source uses _SourceNoPreviewTooltip flags. (#3160)
@ocornut
Copy link
Owner

ocornut commented Apr 27, 2020

Pushed fix by @rokups now to avoid creating the fallback tooltip when ImGuiDragDropFlags_SourceNoPreviewTooltip is set.
Also see #1725 but why we have this "..." tooltip.

@ocornut ocornut closed this as completed Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
drag drop drag and drop
Projects
None yet
Development

No branches or pull requests

2 participants