[Kst] extragear/graphics/kst/kst

Rick Chern rchern at interchange.ubc.ca
Sat Aug 13 00:57:39 CEST 2005


SVN commit 446255 by rchern:

hold down shift to preserve slope when moving line hotpoints

 M  +4 -4      ksttoplevelview.cpp  


--- trunk/extragear/graphics/kst/kst/ksttoplevelview.cpp #446254:446255
@@ -823,9 +823,9 @@
       toPoint = line->to();
       if (shift) {
         if ((double)abs(pos.y() - toPoint.y())/(double)abs(pos.x() - toPoint.x()) < aspect) {
-          fromPoint = QPoint(pos.x(), toPoint.y() - (int)(aspect*abs(pos.x() - toPoint.x())));
+          fromPoint = QPoint(pos.x(), toPoint.y() + (int)(aspect*(pos.x() - toPoint.x())));
         } else {
-          fromPoint = QPoint(toPoint.x() - (int)(aspect*abs(pos.y() - toPoint.y())), pos.y());
+          fromPoint = QPoint(toPoint.x() + (int)((pos.y() - toPoint.y())/aspect), pos.y());
         }
       } else {
         fromPoint = pos;
@@ -835,9 +835,9 @@
       fromPoint = line->from();
       if (shift) {
         if ((double)abs(pos.y() - toPoint.y())/(double)abs(pos.x() - toPoint.x()) < aspect) {
-          toPoint = QPoint(pos.x(), (int)(aspect*abs(pos.x() - fromPoint.x())) + fromPoint.y());
+          toPoint = QPoint(pos.x(), fromPoint.y() + (int)(aspect*(pos.x() - fromPoint.x())));
         } else {
-          toPoint = QPoint((int)(aspect*abs(pos.y() - fromPoint.y())) + fromPoint.x(), pos.y());
+          toPoint = QPoint(fromPoint.x() + (int)((pos.y() - fromPoint.y())/aspect), pos.y());
         }
       } else {
         toPoint = pos;


More information about the Kst mailing list