From 9021f351268e6aa566de80dc7d4e51e71044d0be Mon Sep 17 00:00:00 2001 From: rolandlo Date: Sun, 31 Jan 2021 10:18:27 +0100 Subject: [PATCH] remove unnessary undo actions --- src/control/tools/EditSelectionContents.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/control/tools/EditSelectionContents.cpp b/src/control/tools/EditSelectionContents.cpp index 0b19c0ff..5e1b411b 100644 --- a/src/control/tools/EditSelectionContents.cpp +++ b/src/control/tools/EditSelectionContents.cpp @@ -393,6 +393,8 @@ void EditSelectionContents::updateContent(Rectangle bounds, RectanglelastSnappedBounds.x; double my = snappedBounds.y - this->lastSnappedBounds.y; + bool move = mx != 0 || my != 0; + this->rotation = rotation; double fx = snappedBounds.width / this->lastSnappedBounds.width; @@ -404,13 +406,14 @@ void EditSelectionContents::updateContent(Rectangle bounds, Rectanglerotation - this->lastRotation) > __DBL_EPSILON__); bool scale = (snappedBounds.width != this->lastSnappedBounds.width || snappedBounds.height != this->lastSnappedBounds.height); - if (type == CURSOR_SELECTION_MOVE) { + if (type == CURSOR_SELECTION_MOVE && move) { undo->addUndoAction(std::make_unique(this->sourceLayer, this->sourcePage, &this->selected, mx, my, layer, targetPage)); - } else if (type == CURSOR_SELECTION_ROTATE) { + } else if (type == CURSOR_SELECTION_ROTATE && rotate) { undo->addUndoAction(std::make_unique( this->sourcePage, &this->selected, snappedBounds.x + snappedBounds.width / 2, snappedBounds.y + snappedBounds.height / 2, rotation - this->lastRotation));