TreeNode() fixed IsItemHovered() being inconsistent with visual behavior (#282)

This commit is contained in:
ocornut 2015-08-29 18:15:42 +01:00
parent 65fe60f2b2
commit 64fcb5e568

View File

@ -5384,8 +5384,7 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display
const ImRect interact_bb = display_frame ? bb : ImRect(text_bb.Min, text_bb.Max + ImVec2(style.FramePadding.x*2,0.0f)); // FIXME const ImRect interact_bb = display_frame ? bb : ImRect(text_bb.Min, text_bb.Max + ImVec2(style.FramePadding.x*2,0.0f)); // FIXME
bool opened = TreeNodeBehaviorIsOpened(id, (default_open ? ImGuiTreeNodeFlags_DefaultOpen : 0) | (display_frame ? ImGuiTreeNodeFlags_NoAutoExpandOnLog : 0)); bool opened = TreeNodeBehaviorIsOpened(id, (default_open ? ImGuiTreeNodeFlags_DefaultOpen : 0) | (display_frame ? ImGuiTreeNodeFlags_NoAutoExpandOnLog : 0));
if (!ItemAdd(bb, &id)) if (!ItemAdd(interact_bb, &id))
//if (!ItemAdd(interact_bb, &id)) // Correct but would prevent user from accessing rendered bb which may be of use
return opened; return opened;
bool hovered, held; bool hovered, held;