|
|
|
@ -500,11 +500,13 @@ bool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool
|
|
|
|
|
if (g.DragDropActive && (flags & ImGuiButtonFlags_PressedOnDragDropHold) && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoHoldToOpenOthers))
|
|
|
|
|
if (IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))
|
|
|
|
|
{
|
|
|
|
|
const float DRAG_DROP_HOLD_TIMER = 0.70f;
|
|
|
|
|
hovered = true;
|
|
|
|
|
SetHoveredID(id);
|
|
|
|
|
if (CalcTypematicRepeatAmount(g.HoveredIdTimer + 0.0001f - g.IO.DeltaTime, g.HoveredIdTimer + 0.0001f, 0.70f, 0.00f))
|
|
|
|
|
if (CalcTypematicRepeatAmount(g.HoveredIdTimer + 0.0001f - g.IO.DeltaTime, g.HoveredIdTimer + 0.0001f, DRAG_DROP_HOLD_TIMER, 0.00f))
|
|
|
|
|
{
|
|
|
|
|
pressed = true;
|
|
|
|
|
g.DragDropHoldJustPressedId = id;
|
|
|
|
|
FocusWindow(window);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -5376,7 +5378,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
|
|
|
|
bool toggled = false;
|
|
|
|
|
if (!is_leaf)
|
|
|
|
|
{
|
|
|
|
|
if (pressed)
|
|
|
|
|
if (pressed && g.DragDropHoldJustPressedId != id)
|
|
|
|
|
{
|
|
|
|
|
if ((flags & (ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick)) == 0 || (g.NavActivateId == id))
|
|
|
|
|
toggled = true;
|
|
|
|
@ -5384,8 +5386,12 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* l
|
|
|
|
|
toggled |= is_mouse_x_over_arrow && !g.NavDisableMouseHover; // Lightweight equivalent of IsMouseHoveringRect() since ButtonBehavior() already did the job
|
|
|
|
|
if ((flags & ImGuiTreeNodeFlags_OpenOnDoubleClick) && g.IO.MouseDoubleClicked[0])
|
|
|
|
|
toggled = true;
|
|
|
|
|
if (g.DragDropActive && is_open) // When using Drag and Drop "hold to open" we keep the node highlighted after opening, but never close it again.
|
|
|
|
|
toggled = false;
|
|
|
|
|
}
|
|
|
|
|
else if (pressed && g.DragDropHoldJustPressedId == id)
|
|
|
|
|
{
|
|
|
|
|
IM_ASSERT(button_flags & ImGuiButtonFlags_PressedOnDragDropHold);
|
|
|
|
|
if (!is_open) // When using Drag and Drop "hold to open" we keep the node highlighted after opening, but never close it again.
|
|
|
|
|
toggled = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g.NavId == id && g.NavMoveRequest && g.NavMoveDir == ImGuiDir_Left && is_open)
|
|
|
|
|