[Kst] extragear/graphics/kst/src/libkstapp

Andrew Walker arwalker at sumusltd.com
Tue Aug 1 23:42:52 CEST 2006


SVN commit 568674 by arwalker:

CCBUG:Fix the initial fix for all cases and correctly align the indentation

 M  +36 -34    kstgfxmousehandlerutils.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstgfxmousehandlerutils.cpp #568673:568674
@@ -109,63 +109,65 @@
   QRect newSize;
 
   if (movePoint.y() == anchorPoint.y() ) {
-      int newWidth = pos.x() - anchorPoint.x() + 1; // +1 for the way widths are defined in QRect.
-      double newHalfHeight = originalSize.height()/2.0;
+    int newWidth = pos.x() - anchorPoint.x() + 1; // +1 for the way widths are defined in QRect.
+    double newHalfHeight = originalSize.height()/2.0;
 
-      if (maintainAspect) {
-        newHalfHeight = originalSize.height()*abs(newWidth)/originalSize.width()/2.0;
+    if (maintainAspect) {
+      newHalfHeight = originalSize.height()*abs(newWidth)/originalSize.width()/2.0;
 
-        newHalfHeight = kMin(double(movePoint.y() - bounds.top()), newHalfHeight); // ensure we are still within the bounds.
-        newHalfHeight = kMin(double(bounds.bottom() - movePoint.y()), newHalfHeight);
+      newHalfHeight = kMin(double(movePoint.y() - bounds.top()), newHalfHeight); // ensure we are still within the bounds.
+      newHalfHeight = kMin(double(bounds.bottom() - movePoint.y()), newHalfHeight);
 
-        if (newWidth == 0) { newWidth = 1; } // anything better to be done?
+      if (newWidth == 0) { 
+        newWidth = 1; 
+      } // anything better to be done?
 
-        newWidth = int(originalSize.width()*newHalfHeight*2.0/originalSize.height()*newWidth/abs(newWidth)); // consistency of width w/ the newly calculated height.
-      }
+      newWidth = int(originalSize.width()*newHalfHeight*2.0/originalSize.height()*newWidth/abs(newWidth)); // consistency of width w/ the newly calculated height.
+    }
 
-      newSize.setLeft(anchorPoint.x());
-      newSize.setWidth(newWidth);
-      newSize.setTop(anchorPoint.y() + int(newHalfHeight));
-      newSize.setBottom(anchorPoint.y() - int(newHalfHeight));
+    newSize.setLeft(anchorPoint.x());
+    newSize.setWidth(newWidth);
+    newSize.setTop(anchorPoint.y() + int(newHalfHeight));
+    newSize.setBottom(anchorPoint.y() - int(newHalfHeight));
 
-    } else if (movePoint.x() == anchorPoint.x() ) {
-      // mimic the case for (movePoint.y() == anchorPoint.y()). comments are there.
-      int newHeight = pos.y() - anchorPoint.y() + 1;
-      double newHalfWidth = originalSize.width()/2.0;
+  } else if (movePoint.x() == anchorPoint.x() ) {
+    // mimic the case for (movePoint.y() == anchorPoint.y()). comments are there.
+    int newHeight = pos.y() - anchorPoint.y() + 1;
+    double newHalfWidth = originalSize.width()/2.0;
 
-      if (maintainAspect) {
-        newHalfWidth = originalSize.width()*abs(newHeight)/originalSize.height()/2.0;
+    if (maintainAspect) {
+      newHalfWidth = originalSize.width()*abs(newHeight)/originalSize.height()/2.0;
 
-        newHalfWidth = kMin(double(movePoint.x() - bounds.left()), newHalfWidth);
-        newHalfWidth = kMin(double(bounds.right() - movePoint.x()), newHalfWidth);
+      newHalfWidth = kMin(double(movePoint.x() - bounds.left()), newHalfWidth);
+      newHalfWidth = kMin(double(bounds.right() - movePoint.x()), newHalfWidth);
 
-        if (newHeight == 0) {
-          newHeight = 1;
-        }
-
-        newHeight = int(originalSize.height()*newHalfWidth*2.0/originalSize.width()*newHeight/abs(newHeight));
+      if (newHeight == 0) {
+        newHeight = 1;
       }
 
-      newSize.setTop(anchorPoint.y());
-      newSize.setHeight(newHeight);
-      newSize.setLeft(anchorPoint.x() + int(newHalfWidth));
-      newSize.setRight(anchorPoint.x() - int(newHalfWidth));
+      newHeight = int(originalSize.height()*newHalfWidth*2.0/originalSize.width()*newHeight/abs(newHeight));
     }
 
+    newSize.setTop(anchorPoint.y());
+    newSize.setHeight(newHeight);
+    newSize.setLeft(anchorPoint.x() + int(newHalfWidth));
+    newSize.setRight(anchorPoint.x() - int(newHalfWidth));
+  }
+
   if (newSize.width() < 0) {
     int width = newSize.width();
     newSize.setLeft(newSize.left() + width);
-    newSize.setRight(width * -1);
+    newSize.setRight(newSize.left() + (width * -1));
   }
   if (newSize.height() < 0) {
     int height = newSize.height();
     newSize.setTop(newSize.top() + height);
-    newSize.setHeight(height * -1);
+    newSize.setBottom(newSize.top() + (height * -1));
   }
       
-    newSize = newSize.normalize();
+  newSize = newSize.normalize();
 
-    return newSize;
+  return newSize;
 }
 
 


More information about the Kst mailing list