Skip to content

Commit fef175b

Browse files
committedSep 3, 2013
[diagram] Workaround floating point errors leading to diagram distortion
Fix #8554
1 parent 40ca274 commit fef175b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎src/core/diagram/qgspiediagram.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@ QSizeF QgsPieDiagram::diagramSize( const QgsAttributes& attributes, const QgsRen
6767
// Scale, if extension is smaller than the specified minimum
6868
if ( size.width() <= s.minimumSize && size.height() <= s.minimumSize )
6969
{
70+
bool p = false; // preserve height == width
71+
if ( size.width() == size.height() )
72+
p = true;
73+
7074
size.scale( s.minimumSize, s.minimumSize, Qt::KeepAspectRatio );
75+
76+
// If height == width, recover here (overwrite floating point errors)
77+
if ( p )
78+
size.setWidth( size.height() );
7179
}
7280

7381
return size;

0 commit comments

Comments
 (0)
Please sign in to comment.