svx/source/engine3d/scene3d.cxx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
New commits: commit dcc52933cac1bf08c3e487bd3a12fb035d96eac2 Author: Mike Kaganski <[email protected]> AuthorDate: Wed Feb 8 09:29:34 2023 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Wed Feb 8 07:34:21 2023 +0000 Simplify a bit Change-Id: I77482a2e1d382663ca31991130526feb7ce85504 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146647 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index b5a1afb0f038..905f31fe6f08 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -522,24 +522,18 @@ void E3dScene::Notify(SfxBroadcaster &rBC, const SfxHint &rHint) void E3dScene::RotateScene (const Point& rRef, double sn, double cs) { - Point UpperLeft, LowerRight, Center, NewCenter; + Point NewCenter; auto const& rRectangle = getOutRectangle(); - UpperLeft = rRectangle.TopLeft(); - LowerRight = rRectangle.BottomRight(); - - tools::Long dxOutRectHalf = std::abs(UpperLeft.X() - LowerRight.X()); - dxOutRectHalf /= 2; - tools::Long dyOutRectHalf = std::abs(UpperLeft.Y() - LowerRight.Y()); - dyOutRectHalf /= 2; + Point Center = rRectangle.Center(); // Only the center is moved. The corners are moved by NbcMove. For the // rotation a cartesian coordinate system is used in which the pivot // point is the origin, and the y-axis increases upward, the X-axis to // the right. This must be especially noted for the Y-values. // (When considering a flat piece of paper the Y-axis pointing downwards - Center.setX( (UpperLeft.X() + dxOutRectHalf) - rRef.X() ); - Center.setY( -((UpperLeft.Y() + dyOutRectHalf) - rRef.Y()) ); + Center.setX(Center.X() - rRef.X()); + Center.setY(rRef.Y() - Center.Y()); // A few special cases has to be dealt with first (n * 90 degrees n integer) if (sn==1.0 && cs==0.0) { // 90deg NewCenter.setX( -Center.Y() );
