[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sat Apr 10 13:38:04 UTC 2004


CVS commit by okellogg: 

Fix by Piotr Kolaczkowski:
setLinePositionRelatively(): Temporarily set m_bIgnoreSnapToGrid true when
 setting new X and Y.


  M +8 -23     floatingtext.cpp   1.38


--- kdesdk/umbrello/umbrello/floatingtext.cpp  #1.37:1.38
@@ -91,27 +91,13 @@ void FloatingText::setLinePositionRelati
         int myNewX = getX() + (newX-oldX);
         int myNewY = getY() + (newY-oldY);
-        if ( myNewX >= restrictPositionMin && myNewX <= restrictPositionMax )
-        { // fine
+        bool xIsValid = (myNewX >= restrictPositionMin && myNewX <= restrictPositionMax);
+        bool yIsValid = (myNewY >= restrictPositionMin && myNewY <= restrictPositionMax);
+        if (xIsValid && yIsValid) { // fine
+                bool oldIgnoreSnapToGrid = m_bIgnoreSnapToGrid;
+                m_bIgnoreSnapToGrid = true;
                 setX(myNewX);
-        }
-        else
-        { // something is broken
-                kdDebug() << "FloatingText::setLinePositionRelatively( " << myNewX
-                        << " , " << myNewY << " ) - was Blocked because at least one value is out of bounds: ["
-                        << restrictPositionMin << "..." << restrictPositionMax << "]\n"
-                        << "ToX: " << newX << ", ToY: " << newY
-                        << "FromX: " << oldX << ", FromY: " << oldY
-                        << "CurrentPointX: " << getX() << ", CurrentPointY: " << getY()
-                        << endl;
-                // set to 0
-                setX( 0 );
-        }
-
-        if ( myNewY >= restrictPositionMin && myNewY <= restrictPositionMax )
-        { // fine
                 setY(myNewY);
-        }
-        else
-        { // something is broken
+                m_bIgnoreSnapToGrid = oldIgnoreSnapToGrid;
+        } else { // something is broken
                 kdDebug() << "FloatingText::setLinePositionRelatively( " << myNewX
                         << " , " << myNewY << " ) - was Blocked because at least one value is out of bounds: ["
@@ -121,6 +107,5 @@ void FloatingText::setLinePositionRelati
                         << "CurrentPointX: " << getX() << ", CurrentPointY: " << getY()
                         << endl;
-                // set to 0
-                setY( 0 );
+                // Let's just leave them at their original values.
         }
 }






More information about the umbrello-devel mailing list