Skip to content

Commit 051a315

Browse files
committed
Metrics: fixed table and columns rect highlight from display when metrics window is not in the same viewport as the table.
1 parent dc6e0f4 commit 051a315

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

docs/CHANGELOG.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ Other Changes:
7676
- Demo: About Box: emit infos to convey when IM_ASSERT() macro is disabled,
7777
- so users don't miss out on programming errors being reported.
7878
- so it is included in config/build info submitted in new GitHub Issues.
79-
- Debug Tools: fixed DebugTextEncoding() potentially reading out of bounds
80-
if provided a trailing truncated UTF-8 sequence.
79+
- Debug Tools:
80+
- Fixed DebugTextEncoding() potentially reading out of bounds when
81+
provided a trailing truncated UTF-8 sequence.
82+
- Metrics: fixed table and columns rect highlight from display when
83+
debug/metrics window is not in the same viewport as the table.
8184
- Backends:
8285
- GLFW: fixed building on Linux platforms where Wayland headers
8386
are not available. (#9024, #8969, #8921, #8920) [@jagot]

imgui.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16416,7 +16416,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
1641616416

1641716417
BulletText("Table 0x%08X (%d columns, in '%s')", table->ID, table->ColumnsCount, table->OuterWindow->Name);
1641816418
if (IsItemHovered())
16419-
GetForegroundDrawList()->AddRect(table->OuterRect.Min - ImVec2(1, 1), table->OuterRect.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255), 0.0f, 0, 2.0f);
16419+
GetForegroundDrawList(table->OuterWindow)->AddRect(table->OuterRect.Min - ImVec2(1, 1), table->OuterRect.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255), 0.0f, 0, 2.0f);
1642016420
Indent();
1642116421
char buf[128];
1642216422
for (int rect_n = 0; rect_n < TRT_Count; rect_n++)
@@ -16431,7 +16431,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
1643116431
ImFormatString(buf, IM_ARRAYSIZE(buf), "(%6.1f,%6.1f) (%6.1f,%6.1f) Size (%6.1f,%6.1f) Col %d %s", r.Min.x, r.Min.y, r.Max.x, r.Max.y, r.GetWidth(), r.GetHeight(), column_n, trt_rects_names[rect_n]);
1643216432
Selectable(buf);
1643316433
if (IsItemHovered())
16434-
GetForegroundDrawList()->AddRect(r.Min - ImVec2(1, 1), r.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255), 0.0f, 0, 2.0f);
16434+
GetForegroundDrawList(table->OuterWindow)->AddRect(r.Min - ImVec2(1, 1), r.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255), 0.0f, 0, 2.0f);
1643516435
}
1643616436
}
1643716437
else
@@ -16440,7 +16440,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
1644016440
ImFormatString(buf, IM_ARRAYSIZE(buf), "(%6.1f,%6.1f) (%6.1f,%6.1f) Size (%6.1f,%6.1f) %s", r.Min.x, r.Min.y, r.Max.x, r.Max.y, r.GetWidth(), r.GetHeight(), trt_rects_names[rect_n]);
1644116441
Selectable(buf);
1644216442
if (IsItemHovered())
16443-
GetForegroundDrawList()->AddRect(r.Min - ImVec2(1, 1), r.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255), 0.0f, 0, 2.0f);
16443+
GetForegroundDrawList(table->OuterWindow)->AddRect(r.Min - ImVec2(1, 1), r.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255), 0.0f, 0, 2.0f);
1644416444
}
1644516445
}
1644616446
Unindent();
@@ -17328,7 +17328,7 @@ void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label)
1732817328
if (!is_active) { PopStyleColor(); }
1732917329
if (is_active && IsItemHovered())
1733017330
{
17331-
ImDrawList* draw_list = GetForegroundDrawList();
17331+
ImDrawList* draw_list = GetForegroundDrawList(tab_bar->Window);
1733217332
draw_list->AddRect(tab_bar->BarRect.Min, tab_bar->BarRect.Max, IM_COL32(255, 255, 0, 255));
1733317333
draw_list->AddLine(ImVec2(tab_bar->ScrollingRectMinX, tab_bar->BarRect.Min.y), ImVec2(tab_bar->ScrollingRectMinX, tab_bar->BarRect.Max.y), IM_COL32(0, 255, 0, 255));
1733417334
draw_list->AddLine(ImVec2(tab_bar->ScrollingRectMaxX, tab_bar->BarRect.Min.y), ImVec2(tab_bar->ScrollingRectMaxX, tab_bar->BarRect.Max.y), IM_COL32(0, 255, 0, 255));

imgui_tables.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4028,9 +4028,9 @@ void ImGui::DebugNodeTable(ImGuiTable* table)
40284028
bool open = TreeNode(table, "Table 0x%08X (%d columns, in '%s')%s", table->ID, table->ColumnsCount, table->OuterWindow->Name, is_active ? "" : " *Inactive*");
40294029
if (!is_active) { PopStyleColor(); }
40304030
if (IsItemHovered())
4031-
GetForegroundDrawList()->AddRect(table->OuterRect.Min, table->OuterRect.Max, IM_COL32(255, 255, 0, 255));
4031+
GetForegroundDrawList(table->OuterWindow)->AddRect(table->OuterRect.Min, table->OuterRect.Max, IM_COL32(255, 255, 0, 255));
40324032
if (IsItemVisible() && table->HoveredColumnBody != -1)
4033-
GetForegroundDrawList()->AddRect(GetItemRectMin(), GetItemRectMax(), IM_COL32(255, 255, 0, 255));
4033+
GetForegroundDrawList(table->OuterWindow)->AddRect(GetItemRectMin(), GetItemRectMax(), IM_COL32(255, 255, 0, 255));
40344034
if (!open)
40354035
return;
40364036
if (table->InstanceCurrent > 0)
@@ -4084,7 +4084,7 @@ void ImGui::DebugNodeTable(ImGuiTable* table)
40844084
if (IsItemHovered())
40854085
{
40864086
ImRect r(column->MinX, table->OuterRect.Min.y, column->MaxX, table->OuterRect.Max.y);
4087-
GetForegroundDrawList()->AddRect(r.Min, r.Max, IM_COL32(255, 255, 0, 255));
4087+
GetForegroundDrawList(table->OuterWindow)->AddRect(r.Min, r.Max, IM_COL32(255, 255, 0, 255));
40884088
}
40894089
}
40904090
if (ImGuiTableSettings* settings = TableGetBoundSettings(table))

0 commit comments

Comments
 (0)