mirror of
https://github.com/leozide/leocad
synced 2025-01-14 08:01:45 +01:00
Fixed pieces not sorted correctly when changing their step. Fixes #614.
This commit is contained in:
parent
7931720b5f
commit
48ae9dae17
1 changed files with 21 additions and 8 deletions
|
@ -2861,11 +2861,13 @@ void lcModel::SetSelectedPiecesPieceInfo(PieceInfo* Info)
|
|||
|
||||
void lcModel::SetSelectedPiecesStepShow(lcStep Step)
|
||||
{
|
||||
bool Modified = false;
|
||||
lcArray<lcPiece*> MovedPieces;
|
||||
bool SelectionChanged = false;
|
||||
|
||||
for (lcPiece* Piece : mPieces)
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); )
|
||||
{
|
||||
lcPiece* Piece = mPieces[PieceIdx];
|
||||
|
||||
if (Piece->IsSelected() && Piece->GetStepShow() != Step)
|
||||
{
|
||||
Piece->SetStepShow(Step);
|
||||
|
@ -2876,17 +2878,28 @@ void lcModel::SetSelectedPiecesStepShow(lcStep Step)
|
|||
SelectionChanged = true;
|
||||
}
|
||||
|
||||
Modified = true;
|
||||
MovedPieces.Add(Piece);
|
||||
mPieces.RemoveIndex(PieceIdx);
|
||||
continue;
|
||||
}
|
||||
|
||||
PieceIdx++;
|
||||
}
|
||||
|
||||
if (Modified)
|
||||
if (MovedPieces.IsEmpty())
|
||||
return;
|
||||
|
||||
for (int PieceIdx = 0; PieceIdx < MovedPieces.GetSize(); PieceIdx++)
|
||||
{
|
||||
SaveCheckpoint(tr("Showing Pieces"));
|
||||
UpdateAllViews();
|
||||
gMainWindow->UpdateTimeline(false, false);
|
||||
gMainWindow->UpdateSelectedObjects(SelectionChanged);
|
||||
lcPiece* Piece = MovedPieces[PieceIdx];
|
||||
Piece->SetFileLine(-1);
|
||||
AddPiece(Piece);
|
||||
}
|
||||
|
||||
SaveCheckpoint(tr("Showing Pieces"));
|
||||
UpdateAllViews();
|
||||
gMainWindow->UpdateTimeline(false, false);
|
||||
gMainWindow->UpdateSelectedObjects(SelectionChanged);
|
||||
}
|
||||
|
||||
void lcModel::SetSelectedPiecesStepHide(lcStep Step)
|
||||
|
|
Loading…
Reference in a new issue