mirror of
https://github.com/leozide/leocad
synced 2024-12-28 22:23:35 +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()
|
void lcModel::DuplicateSelectedPieces()
|
||||||
{
|
{
|
||||||
lcArray<lcObject*> NewPieces;
|
lcArray<lcObject*> NewPieces;
|
||||||
|
lcPiece* Focus = nullptr;
|
||||||
|
|
||||||
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
for (int PieceIdx = 0; PieceIdx < mPieces.GetSize(); PieceIdx++)
|
||||||
{
|
{
|
||||||
|
@ -1167,6 +1168,9 @@ void lcModel::DuplicateSelectedPieces()
|
||||||
NewPiece->UpdatePosition(mCurrentStep);
|
NewPiece->UpdatePosition(mCurrentStep);
|
||||||
NewPieces.Add(NewPiece);
|
NewPieces.Add(NewPiece);
|
||||||
|
|
||||||
|
if (Piece->IsFocused())
|
||||||
|
Focus = NewPiece;
|
||||||
|
|
||||||
PieceIdx++;
|
PieceIdx++;
|
||||||
InsertPiece(NewPiece, PieceIdx);
|
InsertPiece(NewPiece, PieceIdx);
|
||||||
}
|
}
|
||||||
|
@ -1175,7 +1179,7 @@ void lcModel::DuplicateSelectedPieces()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gMainWindow->UpdateTimeline(false, false);
|
gMainWindow->UpdateTimeline(false, false);
|
||||||
SetSelectionAndFocus(NewPieces, nullptr, 0);
|
SetSelectionAndFocus(NewPieces, Focus, LC_PIECE_SECTION_POSITION);
|
||||||
SaveCheckpoint(tr("Duplicating Pieces"));
|
SaveCheckpoint(tr("Duplicating Pieces"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue