Improved approach to honor aspect ratio during size changes.

This commit is contained in:
Jim Evins
2015-09-07 16:19:35 -04:00
parent 360d85bbbc
commit 409abe4428
3 changed files with 34 additions and 7 deletions
+7 -3
View File
@@ -778,14 +778,18 @@ namespace glabels
///
void LabelModelObject::setSizeHonorAspect( double w, double h )
{
if ( fabs(w - mW) > fabs(h - mH) )
double aspectRatio = mH / mW;
if ( h > (w*aspectRatio) )
{
setWHonorAspect( w );
h = w*aspectRatio;
}
else
{
setHHonorAspect( h );
w = h/aspectRatio;
}
setSize( w, h );
}