mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-19 01:24:20 +00:00
TreeNode: Fixed bug where BeginDragDropSource() failed when the _OpenOnDoubleClick flag is set. Added basic demo code. (Amend 05420ea)
This commit is contained in:
parent
e8c986b34e
commit
54b38d88f7
3 changed files with 26 additions and 1 deletions
|
|
@ -5360,10 +5360,11 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
|||
// It is rather standard that arrow click react on Down rather than Up and we'd be tempted to make it the default
|
||||
// (by removing the _OpenOnArrow test below), however this would have a perhaps surprising effect on CollapsingHeader()?
|
||||
// So right now we are making this optional. May evolve later.
|
||||
// We set ImGuiButtonFlags_PressedOnClickRelease on OpenOnDoubleClick because we want the item to be active on the initial MouseDown in order for drag and drop to work.
|
||||
if (is_mouse_x_over_arrow && (flags & ImGuiTreeNodeFlags_OpenOnArrow))
|
||||
button_flags |= ImGuiButtonFlags_PressedOnClick;
|
||||
else if (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)
|
||||
button_flags |= ImGuiButtonFlags_PressedOnDoubleClick;
|
||||
button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick;
|
||||
else
|
||||
button_flags |= ImGuiButtonFlags_PressedOnClickRelease;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue