Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix position lock not preventing moving or resizing composer items
  • Loading branch information
nyalldawson committed Oct 3, 2013
1 parent b8a7a2a commit 50542b9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/core/composer/qgscomposermousehandles.cpp
Expand Up @@ -118,13 +118,13 @@ void QgsComposerMouseHandles::drawSelectedItemBounds( QPainter* painter )
QRectF itemSceneBounds = ( *itemIter )->sceneBoundingRect();
//convert scene bounds to handle item bounds
QRectF itemBounds;
if ( mIsDragging )
if ( mIsDragging && !( *itemIter )->positionLock() )
{
//if currently dragging, draw selected item bounds relative to current mouse position
itemBounds = mapRectFromScene( itemSceneBounds );
itemBounds.translate( transform().dx(), transform().dy() );
}
else if ( mIsResizing )
else if ( mIsResizing && !( *itemIter )->positionLock() )
{
//if currently resizing, calculate relative resize of this item
itemBounds = itemSceneBounds;
Expand Down Expand Up @@ -402,6 +402,11 @@ void QgsComposerMouseHandles::mouseReleaseEvent( QGraphicsSceneMouseEvent* event
QList<QgsComposerItem*>::iterator itemIter = selectedItems.begin();
for ( ; itemIter != selectedItems.end(); ++itemIter )
{
if (( *itemIter )->positionLock() )
{
//don't move locked items
continue;
}
QgsComposerItemCommand* subcommand = new QgsComposerItemCommand( *itemIter, "", parentCommand );
subcommand->savePreviousState();
( *itemIter )->move( mEndHandleMovePos.x() - mBeginHandlePos.x(), mEndHandleMovePos.y() - mBeginHandlePos.y() );
Expand All @@ -420,6 +425,11 @@ void QgsComposerMouseHandles::mouseReleaseEvent( QGraphicsSceneMouseEvent* event
QList<QgsComposerItem*>::iterator itemIter = selectedItems.begin();
for ( ; itemIter != selectedItems.end(); ++itemIter )
{
if (( *itemIter )->positionLock() )
{
//don't resize locked items
continue;
}
QgsComposerItemCommand* subcommand = new QgsComposerItemCommand( *itemIter, "", parentCommand );
subcommand->savePreviousState();
QRectF itemBounds = ( *itemIter )->sceneBoundingRect();
Expand Down Expand Up @@ -468,7 +478,7 @@ void QgsComposerMouseHandles::mousePressEvent( QGraphicsSceneMouseEvent* event )
{
mIsDragging = true;
}
else if ( mCurrentMouseMoveAction != QgsComposerMouseHandles::SelectItem &&
else if ( mCurrentMouseMoveAction != QgsComposerMouseHandles::SelectItem &&
mCurrentMouseMoveAction != QgsComposerMouseHandles::NoAction )
{
mIsResizing = true;
Expand Down

0 comments on commit 50542b9

Please sign in to comment.