tdf#84953 Only resize proportionally when dragging on a corner
Change-Id: Iec4eda867216575e058fa673788d9345da05c872 Reviewed-on: https://gerrit.libreoffice.org/23291 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
@@ -297,9 +297,15 @@ bool FuPoor::doConstructOrthogonal() const
|
||||
if (rMarkList.GetMarkCount() == 1)
|
||||
{
|
||||
sal_uInt16 aObjIdentifier = rMarkList.GetMark(0)->GetMarkedSdrObj()->GetObjIdentifier();
|
||||
return aObjIdentifier == OBJ_GRAF ||
|
||||
aObjIdentifier == OBJ_MEDIA ||
|
||||
aObjIdentifier == OBJ_OLE2;
|
||||
bool bIsMediaSelected = aObjIdentifier == OBJ_GRAF ||
|
||||
aObjIdentifier == OBJ_MEDIA ||
|
||||
aObjIdentifier == OBJ_OLE2;
|
||||
|
||||
SdrHdl* pHdl = pView->PickHandle(aMDPos);
|
||||
// Resize proportionally when media is selected and the user drags on a corner
|
||||
if (pHdl)
|
||||
return bIsMediaSelected && pHdl->IsCornerHdl();
|
||||
return bIsMediaSelected;
|
||||
}
|
||||
}
|
||||
else if (aSfxRequest.GetSlot() == SID_DRAW_XPOLYGON || aSfxRequest.GetSlot() == SID_DRAW_XPOLYGON_NOFILL)
|
||||
|
@@ -1124,23 +1124,26 @@ bool FuPoor::cancel()
|
||||
bool FuPoor::doConstructOrthogonal() const
|
||||
{
|
||||
// Check whether a media object is selected
|
||||
bool bIsMediaSelected = false;
|
||||
bool bResizeKeepRatio = false;
|
||||
// tdf#89758 Avoid interactive crop preview from being proportionally scaled by default.
|
||||
if (mpView->AreObjectsMarked() && mpView->GetDragMode() != SDRDRAG_CROP)
|
||||
{
|
||||
const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
|
||||
if (rMarkList.GetMarkCount() == 1)
|
||||
{
|
||||
SdrMark* pMark = rMarkList.GetMark(0);
|
||||
sal_uInt16 aObjIdentifier = pMark->GetMarkedSdrObj()->GetObjIdentifier();
|
||||
bIsMediaSelected = aObjIdentifier == OBJ_GRAF ||
|
||||
sal_uInt16 aObjIdentifier = rMarkList.GetMark(0)->GetMarkedSdrObj()->GetObjIdentifier();
|
||||
bResizeKeepRatio = aObjIdentifier == OBJ_GRAF ||
|
||||
aObjIdentifier == OBJ_MEDIA ||
|
||||
aObjIdentifier == OBJ_OLE2;
|
||||
}
|
||||
}
|
||||
SdrHdl* pHdl = mpView->PickHandle(aMDPos);
|
||||
// Resize proportionally when media is selected and the user drags on a corner
|
||||
if (pHdl)
|
||||
bResizeKeepRatio = bResizeKeepRatio && pHdl->IsCornerHdl();
|
||||
|
||||
return (
|
||||
bIsMediaSelected ||
|
||||
bResizeKeepRatio ||
|
||||
SID_DRAW_XLINE == nSlotId ||
|
||||
SID_DRAW_CIRCLEARC == nSlotId ||
|
||||
SID_DRAW_SQUARE == nSlotId ||
|
||||
|
@@ -4079,29 +4079,34 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
|
||||
if( bIsDocReadOnly )
|
||||
break;
|
||||
|
||||
bool bIsMediaSelected = rSh.GetSelectionType() & nsSelectionType::SEL_GRF ||
|
||||
bool bResizeKeepRatio = rSh.GetSelectionType() & nsSelectionType::SEL_GRF ||
|
||||
rSh.GetSelectionType() & nsSelectionType::SEL_MEDIA ||
|
||||
rSh.GetSelectionType() & nsSelectionType::SEL_OLE;
|
||||
bool bisResize = g_eSdrMoveHdl != HDL_MOVE;
|
||||
|
||||
// Resize proportionally when media is selected and the user drags on a corner
|
||||
const Point aSttPt(PixelToLogic(m_aStartPos));
|
||||
SdrHdl* pHdl = pSdrView->PickHandle(aSttPt);
|
||||
if (pHdl)
|
||||
bResizeKeepRatio = bResizeKeepRatio && pHdl->IsCornerHdl();
|
||||
|
||||
if (pSdrView)
|
||||
{
|
||||
if (pSdrView->GetDragMode() == SDRDRAG_CROP)
|
||||
bisResize = false;
|
||||
|
||||
if (rMEvt.IsShift())
|
||||
{
|
||||
pSdrView->SetAngleSnapEnabled(!bIsMediaSelected);
|
||||
pSdrView->SetAngleSnapEnabled(!bResizeKeepRatio);
|
||||
if (bisResize)
|
||||
pSdrView->SetOrtho(!bIsMediaSelected);
|
||||
pSdrView->SetOrtho(!bResizeKeepRatio);
|
||||
else
|
||||
pSdrView->SetOrtho(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
pSdrView->SetAngleSnapEnabled(bIsMediaSelected);
|
||||
pSdrView->SetAngleSnapEnabled(bResizeKeepRatio);
|
||||
if (bisResize)
|
||||
pSdrView->SetOrtho(bIsMediaSelected);
|
||||
pSdrView->SetOrtho(bResizeKeepRatio);
|
||||
else
|
||||
pSdrView->SetOrtho(false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user