mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 05:05:19 -05:00
impr: Better 3D Visualizer error messages, wrap long visualizer errors (#1969)
### Problem description Long error messages were forcing the width of the window to span the entire screen. ### Implementation description The fix was sending the long message to the log and outputting a short message to the 3d visualizer window. --------- Co-authored-by: WerWolv <werwolv98@gmail.com>
This commit is contained in:
@@ -27,8 +27,20 @@ namespace hex::ui {
|
||||
ImGui::TextUnformatted("hex.ui.pattern_drawer.visualizer.unknown"_lang);
|
||||
}
|
||||
|
||||
if (!m_lastVisualizerError.empty())
|
||||
ImGui::TextUnformatted(m_lastVisualizerError.c_str());
|
||||
if (!m_lastVisualizerError.empty()) {
|
||||
auto windowWidth = ImGui::GetContentRegionAvail().x-2 * ImGuiStyleVar_WindowPadding;
|
||||
auto errorMessageSize = ImGui::CalcTextSize(m_lastVisualizerError.c_str());
|
||||
if (errorMessageSize.x > windowWidth)
|
||||
errorMessageSize.y *= 2;
|
||||
auto errorMessageWindowSize = ImVec2(windowWidth, errorMessageSize.y);
|
||||
if (ImGui::BeginChild("##error_message", errorMessageWindowSize, 0, ImGuiWindowFlags_HorizontalScrollbar)) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0F, 0.0F, 0.0F, 1.0F));
|
||||
ImGui::TextUnformatted(m_lastVisualizerError.c_str());
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
ImGui::EndChild();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user