mirror of
https://github.com/ocornut/imgui.git
synced 2025-02-26 06:48:26 +01:00
Internals, TreeNode: indent all render block into its own scope (aim is to add a is_visible test there later)
This commit is contained in:
parent
fe09ebbe0a
commit
4d8c56c813
@ -12048,6 +12048,7 @@ void ImGui::NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavM
|
|||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
IM_ASSERT(g.NavWindow != NULL);
|
IM_ASSERT(g.NavWindow != NULL);
|
||||||
|
//IMGUI_DEBUG_LOG_NAV("[nav] NavMoveRequestSubmit: dir %c, window \"%s\"\n", "-WENS"[move_dir + 1], g.NavWindow->Name);
|
||||||
|
|
||||||
if (move_flags & ImGuiNavMoveFlags_IsTabbing)
|
if (move_flags & ImGuiNavMoveFlags_IsTabbing)
|
||||||
move_flags |= ImGuiNavMoveFlags_AllowCurrentNavId;
|
move_flags |= ImGuiNavMoveFlags_AllowCurrentNavId;
|
||||||
|
@ -6410,6 +6410,9 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiID storage_id, ImGuiTreeNodeFlags
|
|||||||
if ((flags & (ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_SpanTextWidth | ImGuiTreeNodeFlags_SpanAllColumns)) == 0)
|
if ((flags & (ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_SpanAvailWidth | ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_SpanTextWidth | ImGuiTreeNodeFlags_SpanAllColumns)) == 0)
|
||||||
interact_bb.Max.x = frame_bb.Min.x + text_width + (label_size.x > 0.0f ? style.ItemSpacing.x * 2.0f : 0.0f);
|
interact_bb.Max.x = frame_bb.Min.x + text_width + (label_size.x > 0.0f ? style.ItemSpacing.x * 2.0f : 0.0f);
|
||||||
|
|
||||||
|
// Compute open and multi-select states before ItemAdd() as it clear NextItem data.
|
||||||
|
bool is_open = TreeNodeUpdateNextOpen(storage_id, flags);
|
||||||
|
|
||||||
// Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackgroundChannel for every Selectable..
|
// Modify ClipRect for the ItemAdd(), faster than doing a PushColumnsBackground/PushTableBackgroundChannel for every Selectable..
|
||||||
const float backup_clip_rect_min_x = window->ClipRect.Min.x;
|
const float backup_clip_rect_min_x = window->ClipRect.Min.x;
|
||||||
const float backup_clip_rect_max_x = window->ClipRect.Max.x;
|
const float backup_clip_rect_max_x = window->ClipRect.Max.x;
|
||||||
@ -6418,18 +6421,14 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiID storage_id, ImGuiTreeNodeFlags
|
|||||||
window->ClipRect.Min.x = window->ParentWorkRect.Min.x;
|
window->ClipRect.Min.x = window->ParentWorkRect.Min.x;
|
||||||
window->ClipRect.Max.x = window->ParentWorkRect.Max.x;
|
window->ClipRect.Max.x = window->ParentWorkRect.Max.x;
|
||||||
}
|
}
|
||||||
|
const bool is_visible = ItemAdd(interact_bb, id);
|
||||||
// Compute open and multi-select states before ItemAdd() as it clear NextItem data.
|
|
||||||
bool is_open = TreeNodeUpdateNextOpen(storage_id, flags);
|
|
||||||
bool item_add = ItemAdd(interact_bb, id);
|
|
||||||
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HasDisplayRect;
|
|
||||||
g.LastItemData.DisplayRect = frame_bb;
|
|
||||||
|
|
||||||
if (span_all_columns)
|
if (span_all_columns)
|
||||||
{
|
{
|
||||||
window->ClipRect.Min.x = backup_clip_rect_min_x;
|
window->ClipRect.Min.x = backup_clip_rect_min_x;
|
||||||
window->ClipRect.Max.x = backup_clip_rect_max_x;
|
window->ClipRect.Max.x = backup_clip_rect_max_x;
|
||||||
}
|
}
|
||||||
|
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HasDisplayRect;
|
||||||
|
g.LastItemData.DisplayRect = frame_bb;
|
||||||
|
|
||||||
// If a NavLeft request is happening and ImGuiTreeNodeFlags_NavLeftJumpsBackHere enabled:
|
// If a NavLeft request is happening and ImGuiTreeNodeFlags_NavLeftJumpsBackHere enabled:
|
||||||
// Store data for the current depth to allow returning to this node from any child item.
|
// Store data for the current depth to allow returning to this node from any child item.
|
||||||
@ -6444,7 +6443,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiID storage_id, ImGuiTreeNodeFlags
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool is_leaf = (flags & ImGuiTreeNodeFlags_Leaf) != 0;
|
const bool is_leaf = (flags & ImGuiTreeNodeFlags_Leaf) != 0;
|
||||||
if (!item_add)
|
if (!is_visible)
|
||||||
{
|
{
|
||||||
if (store_tree_node_stack_data && is_open)
|
if (store_tree_node_stack_data && is_open)
|
||||||
TreeNodeStoreStackData(flags); // Call before TreePushOverrideID()
|
TreeNodeStoreStackData(flags); // Call before TreePushOverrideID()
|
||||||
@ -6566,6 +6565,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiID storage_id, ImGuiTreeNodeFlags
|
|||||||
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_ToggledSelection;
|
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_ToggledSelection;
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
|
{
|
||||||
const ImU32 text_col = GetColorU32(ImGuiCol_Text);
|
const ImU32 text_col = GetColorU32(ImGuiCol_Text);
|
||||||
ImGuiNavHighlightFlags nav_highlight_flags = ImGuiNavHighlightFlags_Compact;
|
ImGuiNavHighlightFlags nav_highlight_flags = ImGuiNavHighlightFlags_Compact;
|
||||||
if (is_multi_select)
|
if (is_multi_select)
|
||||||
@ -6612,6 +6612,7 @@ bool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiID storage_id, ImGuiTreeNodeFlags
|
|||||||
RenderTextClipped(text_pos, frame_bb.Max, label, label_end, &label_size);
|
RenderTextClipped(text_pos, frame_bb.Max, label, label_end, &label_size);
|
||||||
else
|
else
|
||||||
RenderText(text_pos, label, label_end, false);
|
RenderText(text_pos, label, label_end, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (store_tree_node_stack_data && is_open)
|
if (store_tree_node_stack_data && is_open)
|
||||||
TreeNodeStoreStackData(flags); // Call before TreePushOverrideID()
|
TreeNodeStoreStackData(flags); // Call before TreePushOverrideID()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user