Skip to content

Commit cbde7d4

Browse files
committedJul 9, 2012
Improve resize behaviour of rotated labels and shapes
1 parent 9dba9de commit cbde7d4

File tree

1 file changed

+8
-27
lines changed

1 file changed

+8
-27
lines changed
 

‎src/core/composer/qgscomposeritem.cpp

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,14 @@ bool QgsComposerItem::imageSizeConsideringRotation( double& width, double& heigh
943943
return true;
944944
}
945945

946+
if ( doubleNear( qAbs( mRotation ), 90 ) || doubleNear( qAbs( mRotation ), 270 ) )
947+
{
948+
double tmp = width;
949+
width = height;
950+
height = tmp;
951+
return true;
952+
}
953+
946954
double x1 = 0;
947955
double y1 = 0;
948956
double x2 = width;
@@ -990,33 +998,6 @@ bool QgsComposerItem::imageSizeConsideringRotation( double& width, double& heigh
990998
width = sqrt(( x2 - p1.x() ) * ( x2 - p1.x() ) + ( y2 - p1.y() ) * ( y2 - p1.y() ) );
991999
height = sqrt(( p3.x() - x2 ) * ( p3.x() - x2 ) + ( p3.y() - y2 ) * ( p3.y() - y2 ) );
9921000
return true;
993-
994-
995-
#if 0
996-
double x1 = 0;
997-
double y1 = 0;
998-
double x2 = width;
999-
double y2 = 0;
1000-
double x3 = width;
1001-
double y3 = height;
1002-
1003-
if ( !cornerPointOnRotatedAndScaledRect( x1, y1, width, height ) )
1004-
{
1005-
return false;
1006-
}
1007-
if ( !cornerPointOnRotatedAndScaledRect( x2, y2, width, height ) )
1008-
{
1009-
return false;
1010-
}
1011-
if ( !cornerPointOnRotatedAndScaledRect( x3, y3, width, height ) )
1012-
{
1013-
return false;
1014-
}
1015-
1016-
width = sqrt(( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) );
1017-
height = sqrt(( x3 - x2 ) * ( x3 - x2 ) + ( y3 - y2 ) * ( y3 - y2 ) );
1018-
return true;
1019-
#endif //0
10201001
}
10211002

10221003
bool QgsComposerItem::cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height ) const

0 commit comments

Comments
 (0)
Please sign in to comment.