svx/source/svdraw/svdograf.cxx | 49 +++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 28 deletions(-)
New commits: commit 4daf1b96c52e8b399908bfeb6871482a6699422c Author: Rashesh <rashesh.pa...@collabora.com> AuthorDate: Sat Feb 15 18:15:54 2025 +0530 Commit: Gökay ŞATIR <gokaysa...@collabora.com> CommitDate: Mon Feb 17 11:54:49 2025 +0100 svdraw: append SdrCropViewHdl instead of prepending in crop mode Previously, enabling crop mode caused the crop handle (SdrCropViewHdl) to be added at the start of the handlers list. This change in order led to a shift in handler IDs, which Collabora Online relies on for identifying and managing handlers. This patch fixes the bug by appending the SdrCropViewHdl to the end of the list, ensuring that the IDs for the main crop handles remain consistent. Change-Id: If082d292e32e242648cf5d04e278880bd457efb5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181705 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Gökay ŞATIR <gokaysa...@collabora.com> diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 0f7151e2957e..5406474b7c52 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -1168,9 +1168,26 @@ void SdrGrafObj::addCropHandles(SdrHdlList& rTarget) const aTranslate); } + basegfx::B2DPoint aPos; + aPos = aMatrix * basegfx::B2DPoint(0.0, 0.0); + rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::UpperLeft, fShearX, fRotate)); + aPos = aMatrix * basegfx::B2DPoint(0.5, 0.0); + rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Upper, fShearX, fRotate)); + aPos = aMatrix * basegfx::B2DPoint(1.0, 0.0); + rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::UpperRight, fShearX, fRotate)); + aPos = aMatrix * basegfx::B2DPoint(0.0, 0.5); + rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Left , fShearX, fRotate)); + aPos = aMatrix * basegfx::B2DPoint(1.0, 0.5); + rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Right, fShearX, fRotate)); + aPos = aMatrix * basegfx::B2DPoint(0.0, 1.0); + rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::LowerLeft, fShearX, fRotate)); + aPos = aMatrix * basegfx::B2DPoint(0.5, 1.0); + rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Lower, fShearX, fRotate)); + aPos = aMatrix * basegfx::B2DPoint(1.0, 1.0); + rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::LowerRight, fShearX, fRotate)); + // get crop values const SdrGrafCropItem& rCrop = GetMergedItem(SDRATTR_GRAFCROP); - if(rCrop.GetLeft() || rCrop.GetTop() || rCrop.GetRight() ||rCrop.GetBottom()) { // decompose object transformation to have current translate and scale @@ -1218,35 +1235,11 @@ void SdrGrafObj::addCropHandles(SdrHdlList& rTarget) const aMatrixForCropViewHdl = aMatrixForCropViewHdl * aPreMultiply; } - rTarget.AddHdl( - std::make_unique<SdrCropViewHdl>( - aMatrixForCropViewHdl, - GetGraphicObject().GetGraphic(), - fCropLeft, - fCropTop, - fCropRight, - fCropBottom)); + rTarget.AddHdl(std::make_unique<SdrCropViewHdl>( + aMatrixForCropViewHdl, GetGraphicObject().GetGraphic(), fCropLeft, fCropTop, + fCropRight, fCropBottom)); } } - - basegfx::B2DPoint aPos; - - aPos = aMatrix * basegfx::B2DPoint(0.0, 0.0); - rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::UpperLeft, fShearX, fRotate)); - aPos = aMatrix * basegfx::B2DPoint(0.5, 0.0); - rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Upper, fShearX, fRotate)); - aPos = aMatrix * basegfx::B2DPoint(1.0, 0.0); - rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::UpperRight, fShearX, fRotate)); - aPos = aMatrix * basegfx::B2DPoint(0.0, 0.5); - rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Left , fShearX, fRotate)); - aPos = aMatrix * basegfx::B2DPoint(1.0, 0.5); - rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Right, fShearX, fRotate)); - aPos = aMatrix * basegfx::B2DPoint(0.0, 1.0); - rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::LowerLeft, fShearX, fRotate)); - aPos = aMatrix * basegfx::B2DPoint(0.5, 1.0); - rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Lower, fShearX, fRotate)); - aPos = aMatrix * basegfx::B2DPoint(1.0, 1.0); - rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::LowerRight, fShearX, fRotate)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */