Skip to content
Permalink
Browse files

[FEATURE] Holding ctrl while dragging a composer selection temporaril…

…y turns off snapping
  • Loading branch information
nyalldawson committed Oct 4, 2013
1 parent bf076a0 commit dae9b5d9840697979208ec3b6004c421d71b85cc
Showing with 15 additions and 5 deletions.
  1. +14 −4 src/core/composer/qgscomposermousehandles.cpp
  2. +1 −1 src/core/composer/qgscomposermousehandles.h
@@ -378,7 +378,7 @@ void QgsComposerMouseHandles::mouseMoveEvent( QGraphicsSceneMouseEvent* event )
if ( mIsDragging )
{
//currently dragging a selection
dragMouseMove( event->lastScenePos(), shiftModifier );
dragMouseMove( event->lastScenePos(), shiftModifier, controlModifier );
}
else if ( mIsResizing )
{
@@ -499,7 +499,7 @@ void QgsComposerMouseHandles::mousePressEvent( QGraphicsSceneMouseEvent* event )

}

void QgsComposerMouseHandles::dragMouseMove( const QPointF& currentPosition, bool lockMovement )
void QgsComposerMouseHandles::dragMouseMove( const QPointF& currentPosition, bool lockMovement, bool preventSnap )
{
if ( !mComposition )
{
@@ -513,8 +513,18 @@ void QgsComposerMouseHandles::dragMouseMove( const QPointF& currentPosition, boo
//find target position before snapping (in scene coordinates)
QPointF upperLeftPoint( mBeginHandlePos.x() + moveX, mBeginHandlePos.y() + moveY );

//snap to grid and guides
QPointF snappedLeftPoint = snapPoint( upperLeftPoint, QgsComposerMouseHandles::Item );
QPointF snappedLeftPoint;
if ( !preventSnap )
{
//snap to grid and guides
snappedLeftPoint = snapPoint( upperLeftPoint, QgsComposerMouseHandles::Item );
}
else
{
//no snapping
snappedLeftPoint = upperLeftPoint;
deleteAlignItems();
}

//calculate total shift for item from beginning of drag operation to current position
double moveRectX = snappedLeftPoint.x() - mBeginHandlePos.x();
@@ -140,7 +140,7 @@ class CORE_EXPORT QgsComposerMouseHandles: public QObject, public QGraphicsRectI
QgsComposerMouseHandles::MouseAction mouseActionForPosition( const QPointF& itemCoordPos );

/**Handles dragging of items during mouse move*/
void dragMouseMove( const QPointF& currentPosition, bool lockMovement );
void dragMouseMove( const QPointF& currentPosition, bool lockMovement, bool preventSnap );
/**Handles resizing of items during mouse move*/
void resizeMouseMove( const QPointF& currentPosition, bool lockAspect, bool fromCenter );

0 comments on commit dae9b5d

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