From 7f43d427c30779f8e992a9893eed1ae57ae12446 Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Thu, 5 Dec 2024 14:29:52 +0800 Subject: [PATCH] FIX: ams control display bug jira: none Change-Id: I72c5977ff4246c19f4bf5ce7e20f797c0efe9e9a --- src/slic3r/GUI/Plater.cpp | 10 ++++++++-- src/slic3r/GUI/Widgets/AMSItem.cpp | 8 ++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index e26c76e52..165669ea5 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -730,9 +730,11 @@ public: txt1->SetForegroundColour(0x6B6B6B); int ams4 = 0, ams1 = 0; GetAMSCount(index, ams4, ams1); - auto val4 = new SpinInput(this, {}, {}, wxDefaultPosition, {FromDIP(60), -1}, 0, 0, 4, ams4); - auto val1 = new SpinInput(this, {}, {}, wxDefaultPosition, {FromDIP(60), -1}, 0, 0, 8, ams1); + auto val4 = new SpinInput(this, {}, {}, wxDefaultPosition, {FromDIP(60), -1}, 0, 0, 4 - ams1, ams4); + auto val1 = new SpinInput(this, {}, {}, wxDefaultPosition, {FromDIP(60), -1}, 0, 0, 4 - ams4, ams1); auto event_handler = [index, val4, val1, extruder](auto &evt) { + val4->SetRange(0, 4 - val1->GetValue()); + val1->SetRange(0, 4 - val4->GetValue()); SetAMSCount(index, val4->GetValue(), val1->GetValue()); UpdateAMSCount(index, extruder); }; @@ -900,6 +902,10 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title void ExtruderGroup::update_ams() { int display_capacity = 8; + + if (ams_n4 * 4 + ams_n1 * 2 <= 8) + is_upward = false; + bool display_front_ams = !is_upward; size_t i = 0; for (; i < ams_n4 && i < 4; ++i) { diff --git a/src/slic3r/GUI/Widgets/AMSItem.cpp b/src/slic3r/GUI/Widgets/AMSItem.cpp index e8595f105..1fc1ba55a 100644 --- a/src/slic3r/GUI/Widgets/AMSItem.cpp +++ b/src/slic3r/GUI/Widgets/AMSItem.cpp @@ -2523,6 +2523,14 @@ void AMSPreview::Update(AMSinfo amsinfo) { m_amsinfo = amsinfo; m_ams_item_type = amsinfo.ams_type; + + if (m_ams_item_type == AMSModel::GENERIC_AMS || m_ams_item_type == AMSModel::AMS_LITE || m_ams_item_type == AMSModel::N3F_AMS) { + SetMinSize(AMS_PREV_FOUR_SIZE); + SetMaxSize(AMS_PREV_FOUR_SIZE); + } else { + SetMinSize(AMS_PREV_SINGLE_SIZE); + SetMaxSize(AMS_PREV_SINGLE_SIZE); + } } void AMSPreview::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)