diff --git a/src/AIAC/ACInfoModel.cpp b/src/AIAC/ACInfoModel.cpp index bb557cc7b..7142032e1 100644 --- a/src/AIAC/ACInfoModel.cpp +++ b/src/AIAC/ACInfoModel.cpp @@ -304,13 +304,20 @@ namespace AIAC cut->SetVisibilityAllCotas(true); } } + this->IsShowingAllComponents = true; } - void TimberInfo::SetAllCotasVisibility(bool visible) + void TimberInfo::UpdateCotasVisibility(bool visible) { - this->IsShowingCotas = visible; - for (const auto& [_, component] : m_Components) { - if(auto cut = dynamic_cast(component)){ + if (!visible || IsShowingAllComponents) { + this->IsShowingCotas = visible; + for (const auto& [_, component] : m_Components) { + if(auto cut = dynamic_cast(component)){ + cut->SetVisibilityAllCotas(visible); + } + } + } else { + if(auto cut = dynamic_cast(this->GetCurrentComponent())){ cut->SetVisibilityAllCotas(visible); } } diff --git a/src/AIAC/ACInfoModel.h b/src/AIAC/ACInfoModel.h index 2322ec4a7..8f4d7fff5 100644 --- a/src/AIAC/ACInfoModel.h +++ b/src/AIAC/ACInfoModel.h @@ -293,7 +293,7 @@ class TimberInfo{ void HideAllComponentsExceptCurrent(); void ShowAllComponents(); - void SetAllCotasVisibility(bool visible); + void UpdateCotasVisibility(bool visible); public: ///< small utilities to calculate the progress of fabrication /// @brief Get the number of fabricate components diff --git a/src/AIAC/LayerUI.cpp b/src/AIAC/LayerUI.cpp index b82920f08..ff02bd269 100644 --- a/src/AIAC/LayerUI.cpp +++ b/src/AIAC/LayerUI.cpp @@ -615,9 +615,9 @@ namespace AIAC ImGui::SameLine(); if(ImGui::Checkbox("Show Cotas", &AIAC_APP.GetLayer()->GetACInfoModel().GetTimberInfo().IsShowingCotas)){ if(AIAC_APP.GetLayer()->GetACInfoModel().GetTimberInfo().IsShowingCotas){ - AIAC_APP.GetLayer()->GetACInfoModel().GetTimberInfo().SetAllCotasVisibility(true); + AIAC_APP.GetLayer()->GetACInfoModel().GetTimberInfo().UpdateCotasVisibility(true); } else { - AIAC_APP.GetLayer()->GetACInfoModel().GetTimberInfo().SetAllCotasVisibility(false); + AIAC_APP.GetLayer()->GetACInfoModel().GetTimberInfo().UpdateCotasVisibility(false); } }