1
0
mirror of synced 2025-01-18 09:04:52 +01:00

impr: Added hint when patterns are still loading

This commit is contained in:
WerWolv 2023-08-30 10:04:06 +02:00
parent 60649d1cba
commit 58cef2361b
4 changed files with 19 additions and 0 deletions

View File

@ -245,4 +245,5 @@ namespace ImGui {
bool DimmedIconButton(const char *symbol, ImVec4 color, ImVec2 size_arg = ImVec2(0, 0));
bool DimmedIconToggle(const char *icon, bool *v);
void TextOverlay(const char *text, ImVec2 pos);
}

View File

@ -810,4 +810,17 @@ namespace ImGui {
return toggled;
}
void TextOverlay(const char *text, ImVec2 pos) {
const auto textSize = ImGui::CalcTextSize(text);
const auto textPos = pos - textSize / 2;
const auto margin = ImGui::GetStyle().FramePadding * 2;
const auto textRect = ImRect(textPos - margin, textPos + textSize + margin);
auto drawList = ImGui::GetForegroundDrawList();
drawList->AddRectFilled(textRect.Min, textRect.Max, ImGui::GetColorU32(ImGuiCol_WindowBg) | 0xFF000000);
drawList->AddRect(textRect.Min, textRect.Max, ImGui::GetColorU32(ImGuiCol_Border));
drawList->AddText(textPos, ImGui::GetColorU32(ImGuiCol_Text), text);
}
}

View File

@ -436,6 +436,7 @@
"hex.builtin.pattern_drawer.tree_style.auto_expanded": "Auto Expanded Tree",
"hex.builtin.pattern_drawer.tree_style.flattened": "Flattened",
"hex.builtin.pattern_drawer.type": "Type",
"hex.builtin.pattern_drawer.updating": "Updating patterns...",
"hex.builtin.pattern_drawer.value": "Value",
"hex.builtin.pattern_drawer.var_name": "Name",
"hex.builtin.pattern_drawer.visualizer.unknown": "Unknown visualizer",

View File

@ -1167,6 +1167,10 @@ namespace hex::plugin::builtin::ui {
ImGui::EndTable();
}
if (this->m_favoritesUpdateTask.isRunning()) {
ImGui::TextOverlay("hex.builtin.pattern_drawer.updating"_lang, ImGui::GetWindowPos() + ImGui::GetWindowSize() / 2);
}
}
void PatternDrawer::reset() {