Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rotation would jump when using undo/redo and trying to modify again #1819

Merged
merged 1 commit into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions core_lib/src/tool/movetool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ void MoveTool::transformSelection(const QPointF& pos, Qt::KeyboardModifiers keyM
if (selectMan->getMoveMode() == MoveMode::ROTATION) {
QPointF anchorPoint = selectMan->currentTransformAnchor();
newAngle = selectMan->angleFromPoint(pos, anchorPoint) - mRotatedAngle;
mPreviousAngle = newAngle;
}

selectMan->adjustSelection(pos, mOffset, newAngle, rotationIncrement);
Expand Down Expand Up @@ -240,7 +239,7 @@ void MoveTool::beginInteraction(const QPointF& pos, Qt::KeyboardModifiers keyMod
mOffset = selectMan->myTranslation();

if(selectMan->getMoveMode() == MoveMode::ROTATION) {
mRotatedAngle = selectMan->angleFromPoint(pos, selectMan->currentTransformAnchor()) - mPreviousAngle;
mRotatedAngle = selectMan->angleFromPoint(pos, selectMan->currentTransformAnchor()) - selectMan->myRotation();
}
}

Expand Down Expand Up @@ -316,7 +315,6 @@ void MoveTool::applyTransformation()
// This ensures that if the selection has been rotated, it will still fit the bounds of the image.
selectMan->setSelection(selectMan->mapToSelection(QPolygonF(selectMan->mySelectionRect())).boundingRect());
mRotatedAngle = 0;
mPreviousAngle = 0;
}

bool MoveTool::leavingThisTool()
Expand Down
1 change: 0 additions & 1 deletion core_lib/src/tool/movetool.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class MoveTool : public BaseTool

QPointF mCurrentPoint;
qreal mRotatedAngle = 0.0;
qreal mPreviousAngle = 0.0;
int mRotationIncrement = 0;
MoveMode mPerspMode;
QPointF mOffset;
Expand Down
Loading