Drag and Drop: Pressing Escape while carrying a payload automatically cancel the active drag and drop. (#9071)
build / Windows (push) Has been cancelled
build / Linux (push) Has been cancelled
build / MacOS (push) Has been cancelled
build / iOS (push) Has been cancelled
build / Emscripten (push) Has been cancelled
build / Android (push) Has been cancelled
scheduled / scheduled (push) Has been cancelled

This commit is contained in:
ocornut
2025-11-18 19:17:20 +01:00
parent 37f9153105
commit 23bd697f05
2 changed files with 7 additions and 0 deletions
+2
View File
@@ -122,6 +122,8 @@ Other Changes:
- Drag and Drop:
- Added ImGuiDragDropFlags_AcceptDrawAsHovered to make accepting item render
as hovered, which can allow using e.g. Button() as drop target. (#8632)
- Pressing Escape while carrying a payload automatically cancel the
active drag and drop. (#9071)
- Style: added ImGuiCol_DragDropTargetBg, style.DragDropTargetRounding,
style.DragDropTargetBorderSize and style.DragDropTargetPadding to configure
the drop target highlight. (#9056) [@aaronkirkham]
+5
View File
@@ -5534,6 +5534,11 @@ void ImGui::NewFrame()
g.DragDropWithinSource = false;
g.DragDropWithinTarget = false;
g.DragDropHoldJustPressedId = 0;
if (g.DragDropActive && IsKeyPressed(ImGuiKey_Escape, ImGuiInputFlags_None, g.ActiveId)) // Also works when g.ActiveId==0 (aka leftover payload in progress, no active id)
{
ClearActiveID();
ClearDragDrop();
}
g.TooltipPreviousWindow = NULL;
// Close popups on focus lost (currently wip/opt-in)