[dia] [flowchart] text fitting fix for Ellipse (continued)



commit 3f3caffa0b6003165942350c6c81c5e824e56c14
Author: Hans Breuer <hans breuer org>
Date:   Fri Jun 28 22:32:53 2013 +0200

    [flowchart] text fitting fix for Ellipse (continued)
    
    Update for recent commit:
    """For text fitting: always we have to adjust the scale between
    text box and ellipse every time, not just when the text box
    radius is smaller than the existing ellipse."""
    
    The unit test complained in _test_movement about always
    resizing object. Now there is a experimental determined
    tolerance of 5% deviation before resizing.

 objects/flowchart/ellipse.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/objects/flowchart/ellipse.c b/objects/flowchart/ellipse.c
index b786e26..d634741 100644
--- a/objects/flowchart/ellipse.c
+++ b/objects/flowchart/ellipse.c
@@ -393,7 +393,8 @@ ellipse_update_data(Ellipse *ellipse, AnchorShape horiz, AnchorShape vert)
   radius2 = distance_point_point(&c, &p);
   
   if (   (radius1 < radius2 && ellipse->text_fitting == TEXTFIT_WHEN_NEEDED)
-      || (ellipse->text_fitting == TEXTFIT_ALWAYS)) {
+      /* stop infinite resizing with 5% tolerance obsvered with _test_movement */
+      || (fabs(1.0 - radius2 / radius1) > 0.05 && ellipse->text_fitting == TEXTFIT_ALWAYS)) {
     /* increase size of the ellipse while keeping its aspect ratio */
     elem->width  *= radius2 / radius1;
     elem->height *= radius2 / radius1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]