mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
FIX:GcodeViwer keep growing width
Change-Id: I25b933985fe38df0f97e3d91a82e66e5c6680c2e
This commit is contained in:
parent
8ad5bdb914
commit
92847823bc
1 changed files with 2 additions and 2 deletions
|
@ -4242,14 +4242,14 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
|||
return ret;
|
||||
};
|
||||
|
||||
auto calculate_offsets = [max_width](const std::vector<std::pair<std::string, std::vector<::string>>>& title_columns, float extra_size = 0.0f) {
|
||||
auto calculate_offsets = [max_width, window_padding](const std::vector<std::pair<std::string, std::vector<::string>>>& title_columns, float extra_size = 0.0f) {
|
||||
const ImGuiStyle& style = ImGui::GetStyle();
|
||||
std::vector<float> offsets;
|
||||
offsets.push_back(max_width(title_columns[0].second, title_columns[0].first, extra_size) + 3.0f * style.ItemSpacing.x);
|
||||
for (size_t i = 1; i < title_columns.size() - 1; i++)
|
||||
offsets.push_back(offsets.back() + max_width(title_columns[i].second, title_columns[i].first) + style.ItemSpacing.x);
|
||||
if (title_columns.back().first == _u8L("Display"))
|
||||
offsets.back() = ImGui::GetWindowWidth() - ImGui::CalcTextSize(_u8L("Display").c_str()).x - 2 * style.ItemSpacing.x;
|
||||
offsets.back() = ImGui::GetWindowWidth() - ImGui::CalcTextSize(_u8L("Display").c_str()).x - ImGui::GetFrameHeight() / 2 - 2 * window_padding;
|
||||
|
||||
float average_col_width = ImGui::GetWindowWidth() / static_cast<float>(title_columns.size());
|
||||
std::vector<float> ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue