Fix:fix filament arrange ui

jira: nojira
Change-Id: I543c212d8e28f2701f8494f031c24090d9fe7617
This commit is contained in:
Mack 2025-02-20 17:50:13 +08:00 committed by lane.wei
parent 996f299503
commit dcfc5af245
2 changed files with 10 additions and 8 deletions

View File

@ -111,22 +111,24 @@ void ColorPanel::OnPaint(wxPaintEvent &event)
wxPaintDC dc(this);
wxSize size = GetSize();
// If it matches the parent's width, it will not be displayed completely
int svg_size = size.GetWidth() - FromDIP(3);
int svg_size = size.GetWidth();
int type_label_height = FromDIP(10);
wxString type_label(m_type);
int type_label_margin = FromDIP(6);
int type_label_margin = FromDIP(3);
std::string replace_color = m_color.GetAsString(wxC2S_HTML_SYNTAX).ToStdString();
std::string svg_name = "outlined_rect";
if (replace_color == "#FFFFFF00") {
svg_name = "outlined_rect_transparent";
}
wxBitmap bmp = ScalableBitmap(this, svg_name, svg_size, false, false, false, { replace_color }).bmp();
static Slic3r::GUI::BitmapCache cache;
wxBitmap* bmp = cache.load_svg(svg_name, 0, svg_size, false, false, replace_color, 0.f);
//wxBitmap bmp = ScalableBitmap(this, svg_name, svg_size, false, false, false, { replace_color }).bmp();
// ScalableBitmap is not drawn at position (0, 0) by default, why?
dc.DrawBitmap(bmp, wxPoint(-FromDIP(3), -FromDIP(3)));
dc.DrawBitmap(*bmp, wxPoint(0,0));
//dc.SetPen(wxPen(*wxBLACK, 1));
//dc.DrawRectangle(0, 0, FromDIP(25), FromDIP(25));
//dc.DrawRectangle(0, 0, svg_size, svg_size);
wxString label = wxString::Format(wxT("%d"), m_filament_id);
dc.SetTextForeground(m_color.GetLuminance() < 0.51 ? *wxWHITE : *wxBLACK); // set text color

View File

@ -4735,7 +4735,7 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
filament_group_item_align_width = max(filament_group_item_align_width, text_size.x);
text_line_height = max(text_line_height, text_size.y);
}
container_height += (three_words_width * 1.2f + text_line_height );
container_height += (three_words_width * 1.3f + text_line_height );
}
container_height += 2 * line_height;
ams_item_height = std::max(ams_item_height, container_height);
@ -4755,7 +4755,7 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(.15f, .18f, .19f, 1.0f));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(window_padding * 3, 0));
ImGui::Dummy({window_padding, window_padding});
// ImGui::Dummy({window_padding, window_padding});
ImGui::BeginChild("#AMS", ImVec2(0, AMS_container_height), true, ImGuiWindowFlags_AlwaysUseWindowPadding);
{
float available_width = ImGui::GetContentRegionAvail().x;
@ -6183,7 +6183,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
for (auto item : options_items)
append_option_item(item, offsets);
}
ImGui::Dummy({ window_padding, window_padding });
if (m_nozzle_nums > 1)
render_legend_color_arr_recommen(window_padding);