Skip to content
Permalink
Browse files

Fix position lock not preventing moving or resizing composer items

  • Loading branch information
nyalldawson committed Oct 3, 2013
1 parent b8a7a2a commit 50542b91fa9ff6cbec3f90da0172b0eeeb033477
Showing with 13 additions and 3 deletions.
  1. +13 −3 src/core/composer/qgscomposermousehandles.cpp
@@ -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;
@@ -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() );
@@ -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();
@@ -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;

0 comments on commit 50542b9

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