Skip to content
Permalink
Browse files

[FEATURE] Pressing shift while moving composer items constrains movem…

…ent to horizontal/vertical axis
  • Loading branch information
nyalldawson committed Oct 3, 2013
1 parent 9eddf69 commit 22e11bae94f3c9f4a79d1061a24e3fe31fd4c16f
Showing with 14 additions and 2 deletions.
  1. +14 −2 src/core/composer/qgscomposermousehandles.cpp
@@ -516,12 +516,24 @@ void QgsComposerMouseHandles::dragMouseMove( const QPointF& currentPosition, boo
//snap to grid and guides
QPointF snappedLeftPoint = snapPoint( upperLeftPoint, QgsComposerMouseHandles::Item );

//TODO: shift moving should lock to horizontal/vertical movement

//calculate total shift for item from beginning of drag operation to current position
double moveRectX = snappedLeftPoint.x() - mBeginHandlePos.x();
double moveRectY = snappedLeftPoint.y() - mBeginHandlePos.y();

if ( lockMovement )
{
//constrained (shift) moving should lock to horizontal/vertical movement
//reset the smaller of the x/y movements
if ( abs( moveRectX ) <= abs( moveRectY ) )
{
moveRectX = 0;
}
else
{
moveRectY = 0;
}
}

//shift handle item to new position
QTransform moveTransform;
moveTransform.translate( moveRectX, moveRectY );

0 comments on commit 22e11ba

Please sign in to comment.
You can’t perform that action at this time.