mirror of
https://github.com/leozide/leocad
synced 2024-12-27 21:58:37 +01:00
Preserve focus when duplicating pieces. Fixes #130.
This commit is contained in:
parent
657fdc0f2b
commit
fd19af8e73
1 changed files with 5 additions and 1 deletions
|
@ -1155,6 +1155,7 @@ void lcModel::Paste()
|
|||
void lcModel::DuplicateSelectedPieces()
|
||||
{
|
||||
lcArray<lcObject*> NewPieces;
|
||||
lcPiece* Focus = nullptr;
|
||||
|
||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||
{
|
||||
|
@ -1167,6 +1168,9 @@ void lcModel::DuplicateSelectedPieces()
|
|||
NewPiece->UpdatePosition(mCurrentStep);
|
||||
NewPieces.Add(NewPiece);
|
||||
|
||||
if (Piece->IsFocused())
|
||||
Focus = NewPiece;
|
||||
|
||||
PieceIdx++;
|
||||
InsertPiece(NewPiece, PieceIdx);
|
||||
}
|
||||
|
@ -1175,7 +1179,7 @@ void lcModel::DuplicateSelectedPieces()
|
|||
return;
|
||||
|
||||
gMainWindow->UpdateTimeline(false, false);
|
||||
SetSelectionAndFocus(NewPieces, nullptr, 0);
|
||||
SetSelectionAndFocus(NewPieces, Focus, LC_PIECE_SECTION_POSITION);
|
||||
SaveCheckpoint(tr("Duplicating Pieces"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue