mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-09 23:54:20 +00:00
Drag and Drop: Pressing Escape while carrying a payload automatically cancel the active drag and drop. (#9071)
This commit is contained in:
parent
37f9153105
commit
23bd697f05
2 changed files with 7 additions and 0 deletions
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue