Keep extruder switch button padding after a DPI change

This commit is contained in:
SoftFever
2026-10-10 02:45:18 +08:00
parent 3755618146
commit bef49a330b
3 changed files with 12 additions and 8 deletions
+3 -3
View File
@@ -8456,11 +8456,11 @@ void Tab::update_extruder_variants(int extruder_id, bool reload)
int item_n = options.empty() ? 0 : options.size();
if (m_type == Preset::TYPE_PRINTER){ // we are on printer settings dialog and larger padding can be used
int h_pad = item_n > 14 ? 6 : item_n > 12 ? 8 : item_n > 10 ? 16 : item_n > 8 ? 20 : item_n > 6 ? 24 : (item_n > 4 ? 36 : (item_n > 2 ? 48 : 64));
m_extruder_switch->SetButtonPadding(FromDIP(wxSize(h_pad,3)));
m_extruder_switch->SetButtonPadding(wxSize(h_pad, 3));
}
else {
int h_pad = item_n > 6 ? 6 : (item_n > 4 ? 10 : (item_n > 2 ? 20 : 36));
m_extruder_switch->SetButtonPadding(FromDIP(wxSize(h_pad,3)));
m_extruder_switch->SetButtonPadding(wxSize(h_pad, 3));
}
int selection_index;
@@ -8490,7 +8490,7 @@ void Tab::update_extruder_variants(int extruder_id, bool reload)
m_variant_combo->SetOptions(options);
int item_n = options.empty() ? 0 : options.size();
int h_pad = item_n > 6 ? 6 : (item_n > 4 ? 8 : (item_n > 2 ? 20 : 36));
m_variant_combo->SetButtonPadding(FromDIP(wxSize(h_pad,3)));
m_variant_combo->SetButtonPadding(wxSize(h_pad, 3));
if (!options.empty())
m_variant_combo->SetSelection(selection < 0 || selection >= (int) options.size() ? 0 : selection);