Skip to content

Commit 7c06865

Browse files
phraktleclaude
andauthored
fix: disambiguate Drop Target button IDs in Drag'N'Drop demo (#387)
The demo renders three drop-target buttons whose labels share the same value of the mutable 'data' field, so imgui hashes three identical item IDs within the same window. This was silently broken pre-1.91 (drop zones shared hover/active state) and surfaces as a visible "3 visible items with conflicting ID!" warning now that imgui 1.91's ConfigDebugHighlightIdConflicts is on by default in debug builds. Wrap each drop-target block in a PushID("any"/"string"/"class") / PopID() pair so the buttons share a human-readable label but are distinguished in the ID stack. This is the resolution imgui's own warning recommends first. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 336de93 commit 7c06865

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

example/src/main/java/ExampleDragAndDrop.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,26 @@ public static void show(final ImBoolean showDragNDropWindow) {
3434
ImGui.separator();
3535

3636
ImGui.text("Drop here any:");
37+
ImGui.pushID("any");
3738
ImGui.button(data, 100, 50);
3839
setupTarget();
40+
ImGui.popID();
3941

4042
ImGui.separator();
4143

4244
ImGui.text("Drop here string payload only");
45+
ImGui.pushID("string");
4346
ImGui.button(data, 100, 50);
4447
setupStringPayloadTarget();
48+
ImGui.popID();
4549

4650
ImGui.separator();
4751

4852
ImGui.text("Drop here class specific payload only");
53+
ImGui.pushID("class");
4954
ImGui.button(data, 100, 50);
5055
setupClassSpecificPayloadTarget();
56+
ImGui.popID();
5157
}
5258
ImGui.end();
5359
}

0 commit comments

Comments
 (0)