@@ -646,9 +646,12 @@ void QgsLayoutMouseHandles::mouseReleaseEvent( QGraphicsSceneMouseEvent *event )
646
646
itemRect = itemRect.normalized ();
647
647
QPointF newPos = mapToScene ( itemRect.topLeft () );
648
648
649
- #if 0 //TODO - convert to existing units
650
- item->attemptMove( newPos.x(), newPos.y(), itemRect.width(), itemRect.height(), QgsComposerItem::UpperLeft, true );
651
- #endif
649
+ // translate new position to current item units
650
+ QgsLayoutPoint itemPos = mLayout ->convertFromLayoutUnits ( newPos, item->positionWithUnits ().units () );
651
+ item->attemptMove ( itemPos );
652
+
653
+ QgsLayoutSize itemSize = mLayout ->convertFromLayoutUnits ( itemRect.size (), item->sizeWithUnits ().units () );
654
+ item->attemptResize ( itemSize );
652
655
#if 0
653
656
subcommand->saveAfterState();
654
657
#endif
@@ -777,11 +780,9 @@ QSizeF QgsLayoutMouseHandles::calcCursorEdgeOffset( QPointF cursorPos )
777
780
778
781
case QgsLayoutMouseHandles::ResizeLeftDown:
779
782
return QSizeF ( sceneMousePos.x (), sceneMousePos.y () - rect ().height () );
780
-
781
- // default:
782
- // return QSizeF( 0, 0 );
783
783
}
784
784
785
+ return QSizeF ();
785
786
}
786
787
787
788
void QgsLayoutMouseHandles::dragMouseMove ( QPointF currentPosition, bool lockMovement, bool preventSnap )
@@ -866,6 +867,7 @@ void QgsLayoutMouseHandles::resizeMouseMove( QPointF currentPosition, bool lockR
866
867
QPointF snappedPosition = snapPoint( QPointF( currentPosition.x() - mCursorOffset.width(), currentPosition.y() - mCursorOffset.height() ), QgsLayoutMouseHandles::Point );
867
868
finalPosition = mapFromScene( snappedPosition );
868
869
#endif
870
+ finalPosition = mapFromScene ( currentPosition );
869
871
}
870
872
else
871
873
{
0 commit comments