fix: Static tooltips not rendering correctly

This commit is contained in:
WerWolv 2022-10-28 14:33:26 +02:00
parent db3072630a
commit 9fd37221f6
3 changed files with 9 additions and 12 deletions

View File

@ -650,29 +650,24 @@ namespace hex::plugin::builtin {
callback(address, data, size);
}
const auto &tooltips = ImHexApi::HexEditor::impl::getTooltips();
if (!tooltips.empty()) {
ImGui::BeginTooltip();
for (const auto &[id, tooltip] : tooltips) {
for (const auto &[id, tooltip] : ImHexApi::HexEditor::impl::getTooltips()) {
if (tooltip.getRegion().overlaps({ address, size })) {
ImGui::BeginTooltip();
if (ImGui::BeginTable("##tooltips", 1, ImGuiTableFlags_NoHostExtendX | ImGuiTableFlags_RowBg | ImGuiTableFlags_NoClip)) {
ImGui::TableNextRow();
ImGui::TableNextColumn();
if (tooltip.getRegion().overlaps({ address, size })) {
ImGui::ColorButton(tooltip.getValue().c_str(), ImColor(tooltip.getColor()));
ImGui::SameLine(0, 10);
ImGui::TextUnformatted(tooltip.getValue().c_str());
}
ImGui::ColorButton(tooltip.getValue().c_str(), ImColor(tooltip.getColor()));
ImGui::SameLine(0, 10);
ImGui::TextUnformatted(tooltip.getValue().c_str());
ImGui::PushStyleColor(ImGuiCol_TableRowBg, tooltip.getColor());
ImGui::PushStyleColor(ImGuiCol_TableRowBgAlt, tooltip.getColor());
ImGui::EndTable();
ImGui::PopStyleColor(2);
}
ImGui::EndTooltip();
}
ImGui::EndTooltip();
}
ImGui::PopStyleVar();

View File

@ -412,6 +412,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.yara.header.rules", "规则" },
{ "hex.builtin.view.yara.reload", "重新加载" },
{ "hex.builtin.view.yara.match", "匹配规则" },
//{ "hex.builtin.view.yara.reset", "Reset" },
{ "hex.builtin.view.yara.matching", "匹配中..." },
{ "hex.builtin.view.yara.error", "Yara 编译器错误: " },
{ "hex.builtin.view.yara.header.matches", "匹配" },

View File

@ -409,6 +409,7 @@ namespace hex::plugin::builtin {
{ "hex.builtin.view.yara.header.rules", "規則" },
{ "hex.builtin.view.yara.reload", "重新載入" },
{ "hex.builtin.view.yara.match", "Match Rules" },
//{ "hex.builtin.view.yara.reset", "Reset" },
{ "hex.builtin.view.yara.matching", "Matching..." },
{ "hex.builtin.view.yara.error", "Yara 編譯器錯誤:" },
{ "hex.builtin.view.yara.header.matches", "Matches" },