FIX: ScalableButton size

Change-Id: I944dc4fb96a58641aa8502233ffe87dedc128657
Jira: STUDIO-13262
(cherry picked from commit c78a697f0ee4a40009373cb560def12e4553fd40)
This commit is contained in:
chunmao.guo 2025-07-08 20:21:47 +08:00 committed by Noisyfox
parent 7f71c59490
commit 92a8b0b43e
2 changed files with 7 additions and 5 deletions

View file

@ -1031,20 +1031,22 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title
hsizer_ams->Add(btn_edit, 0, wxLEFT | wxALIGN_CENTER, FromDIP(2));
hsizer_ams->Add(ams_not_installed_msg, 0, wxALIGN_CENTER);
btn_up = new ScalableButton(this, wxID_ANY, "page_up", "", {-1, FromDIP(14)});
btn_up = new ScalableButton(this, wxID_ANY, "page_up", "", {FromDIP(14), FromDIP(14)}, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 14);
btn_up->SetBackgroundColour(*wxWHITE);
btn_up->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this, index](auto &evt) {
if (page_cur > 0)
--page_cur;
update_ams();
});
btn_down = new ScalableButton(this, wxID_ANY, "page_down", "", {-1, FromDIP(14)});
btn_up->Hide();
btn_down = new ScalableButton(this, wxID_ANY, "page_down", "", {FromDIP(14), FromDIP(14)}, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, false, 14);
btn_down->SetBackgroundColour(*wxWHITE);
btn_down->Bind(wxEVT_COMMAND_BUTTON_CLICKED, [this, index](auto &evt) {
if (page_cur + 1 < page_num)
++page_cur;
update_ams();
});
btn_down->Hide();
wxBoxSizer *hsizer_diameter = new wxBoxSizer(wxHORIZONTAL);
hsizer_diameter->Add(label_diameter, 0, wxALIGN_CENTER);

View file

@ -1088,8 +1088,8 @@ ScalableButton::ScalableButton( wxWindow * parent,
if (size != wxDefaultSize)
{
const int em = em_unit(parent);
m_width = size.x/em;
m_height= size.y/em;
m_width = size.x * 10 / em;
m_height= size.y * 10 / em;
}
}
@ -1178,7 +1178,7 @@ void ScalableButton::msw_rescale()
if (m_width > 0 || m_height>0)
{
const int em = em_unit(m_parent);
wxSize size(m_width * em, m_height * em);
wxSize size(m_width * em / 10, m_height * em / 10);
SetMinSize(size);
}
}