perf(explorer): cull off-screen rows in the block detail list
The block detail modal drew every transaction row of a block, running the hit-test, the draw and a hash truncation for each one, even when the row sat far outside the scroll viewport. - A row entirely outside the scroll clip now keeps its layout slot (so the scroll extent is unchanged) but skips the hit-test, draw and hash truncation. The expanded row is always laid out so its inline detail panel still appears. - The old "showing first 100 of N" footer is dropped, since every row is now cheap to lay out regardless of how many a block has. No visible change; only off-screen rows are skipped. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1205,6 +1205,9 @@ static void renderBlockDetailModal(App* app) {
|
|||||||
float txContentW = ImGui::GetContentRegionAvail().x;
|
float txContentW = ImGui::GetContentRegionAvail().x;
|
||||||
|
|
||||||
ImGui::InvisibleButton("##txRow", ImVec2(txContentW, txRowH));
|
ImGui::InvisibleButton("##txRow", ImVec2(txContentW, txRowH));
|
||||||
|
// Rows outside the scroll clip keep their layout slot (the button above) but skip the hit-test results,
|
||||||
|
// drawing and truncateHashToFit below. The expanded row is always laid out so its detail panel appears.
|
||||||
|
if (!isExpanded && !ImGui::IsItemVisible()) { ImGui::PopID(); continue; }
|
||||||
bool rowHovered = ImGui::IsItemHovered();
|
bool rowHovered = ImGui::IsItemHovered();
|
||||||
bool rowClicked = ImGui::IsItemClicked(0);
|
bool rowClicked = ImGui::IsItemClicked(0);
|
||||||
bool rightClicked = ImGui::IsItemClicked(1);
|
bool rightClicked = ImGui::IsItemClicked(1);
|
||||||
@@ -1313,11 +1316,6 @@ static void renderBlockDetailModal(App* app) {
|
|||||||
|
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_detail_txids.size() > 100) {
|
|
||||||
snprintf(buf, sizeof(buf), TR("grpa_showing_first_100_of"), (int)s_detail_txids.size());
|
|
||||||
ImGui::TextDisabled("%s", buf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EndOverlayDialog();
|
EndOverlayDialog();
|
||||||
|
|||||||
Reference in New Issue
Block a user