Skip to content

Commit

Permalink
Fix: cotas visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Petingo committed Aug 19, 2024
1 parent 1a0c929 commit d165c0e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
15 changes: 11 additions & 4 deletions src/AIAC/ACInfoModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Cut*>(component)){
if (!visible || IsShowingAllComponents) {
this->IsShowingCotas = visible;
for (const auto& [_, component] : m_Components) {
if(auto cut = dynamic_cast<Cut*>(component)){
cut->SetVisibilityAllCotas(visible);
}
}
} else {
if(auto cut = dynamic_cast<Cut*>(this->GetCurrentComponent())){
cut->SetVisibilityAllCotas(visible);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/AIAC/ACInfoModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/AIAC/LayerUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,9 @@ namespace AIAC
ImGui::SameLine();
if(ImGui::Checkbox("Show Cotas", &AIAC_APP.GetLayer<LayerModel>()->GetACInfoModel().GetTimberInfo().IsShowingCotas)){
if(AIAC_APP.GetLayer<LayerModel>()->GetACInfoModel().GetTimberInfo().IsShowingCotas){
AIAC_APP.GetLayer<LayerModel>()->GetACInfoModel().GetTimberInfo().SetAllCotasVisibility(true);
AIAC_APP.GetLayer<LayerModel>()->GetACInfoModel().GetTimberInfo().UpdateCotasVisibility(true);
} else {
AIAC_APP.GetLayer<LayerModel>()->GetACInfoModel().GetTimberInfo().SetAllCotasVisibility(false);
AIAC_APP.GetLayer<LayerModel>()->GetACInfoModel().GetTimberInfo().UpdateCotasVisibility(false);
}
}

Expand Down

0 comments on commit d165c0e

Please sign in to comment.