svn commit: r16121 - trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/PathItemPlacement.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-11-21 14:28:14-0800
New Revision: 16121

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/PathItemPlacement.java

Log:
Decrease scale factor to make repositioning smoother and more accurate

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/PathItemPlacement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/PathItemPlacement.java?view=diff&rev=16121&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/PathItemPlacement.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/PathItemPlacement.java&r1=16120&r2=16121
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/PathItemPlacement.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/PathItemPlacement.java	2008-11-21 14:28:14-0800
@@ -253,6 +253,7 @@
 
         // Check for a collision between our computed position and the edge
         if (useCollisionCheck) {
+            double scaleFactor = 1.2; // increase offset by 20% at a time
 
             // TODO: The size of text figs, which is what we care about most,
             // isn't computed correctly by GEF. If we got ambitious, we could
@@ -265,8 +266,8 @@
             Point[] points = fp.getPoints();
             if (intersects(points, result, size)) {
 
-                // increase offset by 50% at a time until we're clear
-                int scaledOffset = vectorOffset;
+                // increase offset by 20% at a time until we're clear
+                int scaledOffset = (int) (vectorOffset * scaleFactor);
                 // If offset is zero, use a default based on the size of the fig
                 if (scaledOffset == 0) {
                     scaledOffset = (size.width + size.height) / 4;
@@ -277,8 +278,7 @@
                 // limit our retries in case its too hard to get free
                 while (intersects(points, result, size) && count++ < limit) {
                     applyOffset(slope, scaledOffset, result);
-                    // Add double our offset every try
-                    scaledOffset *= 2;
+                    scaledOffset *= scaleFactor;
                 }
                 // If we timed out, give it one more try on the other side
                 if (false /* count >= limit */) {
@@ -293,6 +293,7 @@
                     while (intersects(points, result, size) 
                             && count++ < limit) {
                         applyOffset(slope, scaledOffset, result);
+                        scaledOffset *= scaleFactor;
                     }
                 }
 //                LOG.debug("Final point #" + count + " " + result
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.