Nelarius / imnodes

A small, dependency-free node editor for dear imgui
MIT License
1.94k stars 236 forks source link

Overlapping nodes aren't compatible with ImGui::BeginDragDropTarget() #179

Open Pycorax opened 1 year ago

Pycorax commented 1 year ago

Description

Given an ImNodes node which contains a drag and drop target that is implemented using ImGui::BeginDragDropTarget() and ImGui::EndDragDropTarget(), if two of these nodes overlap such that the drag and drop targets overlap, attempting to drag and drop anything on to it will result in an assertion failure in ImGui::BeginDragDropTarget(): IM_ASSERT(g.DragDropWithinTarget == false); which results in a crash.

This works perfectly fine if there is no overlap. I'm not too sure how fix-able this issue is from ImNodes since it seems to be a limitation with ImGui's implementation of drag and drop targets but I figured it's important to note it here.

Demo

https://user-images.githubusercontent.com/8434128/223911833-7f1cf652-ae35-4b76-97f7-49199bd5d7f7.mp4

skaarj1989 commented 1 year ago

Works fine for me.

ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAllowNullID)

2023-03-14 13-45-07.webm