Place a piece according to margins values.

This commit is contained in:
Roman Telezhynskyi 2021-09-06 18:29:59 +03:00
parent a9e5ea55cf
commit c32a4f60b0

View file

@ -210,9 +210,15 @@ void VPCarrouselPieceList::contextMenuEvent(QContextMenuEvent *event)
if (selectedAction == moveAction) if (selectedAction == moveAction)
{ {
piece->ClearTransformations(); VPSheetPtr sheet = layout->GetFocusedSheet();
auto *command = new VPUndoMovePieceOnSheet(layout->GetFocusedSheet(), piece); if (not sheet.isNull())
layout->UndoStack()->push(command); {
piece->ClearTransformations();
QRectF rect = sheet->GetMarginsRect();
piece->SetPosition(QPointF(rect.topLeft().x() + 1, rect.topLeft().y() + 1));
auto *command = new VPUndoMovePieceOnSheet(layout->GetFocusedSheet(), piece);
layout->UndoStack()->push(command);
}
} }
else if (selectedAction == deleteAction) else if (selectedAction == deleteAction)
{ {