mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-15 00:44:20 +00:00
CollapsingHeader(bool*) variant: fixed for IsItemHovered() to work properly in the nav branch.Basically the close button now has to use ItemAdd() to be navable into, which overwrite the IsItemHovered data. (#600, #787)
This commit is contained in:
parent
ef3f87eec5
commit
a03093b2d4
3 changed files with 17 additions and 1 deletions
|
|
@ -6273,8 +6273,11 @@ bool ImGui::CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags
|
|||
// Create a small overlapping close button // FIXME: We can evolve this into user accessible helpers to add extra buttons on title bars, headers, etc.
|
||||
ImGuiContext& g = *GImGui;
|
||||
float button_sz = g.FontSize * 0.5f;
|
||||
ImGuiItemHoveredDataBackup last_item_backup;
|
||||
last_item_backup.Backup();
|
||||
if (CloseButton(window->GetID((void*)(intptr_t)(id+1)), ImVec2(ImMin(window->DC.LastItemRect.Max.x, window->ClipRect.Max.x) - g.Style.FramePadding.x - button_sz, window->DC.LastItemRect.Min.y + g.Style.FramePadding.y + button_sz), button_sz))
|
||||
*p_open = false;
|
||||
last_item_backup.Restore();
|
||||
}
|
||||
|
||||
return is_open;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue