[Kst] branches/work/kst/portto4/kst/src/libkstapp

Mike Fenton mike at staikos.net
Fri May 15 22:13:50 CEST 2009


SVN commit 968485 by fenton:

Fix cursor drifting when resizing / rotating objects.


 M  +2 -3      lineitem.cpp  
 M  +8 -9      viewitem.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/lineitem.cpp #968484:968485
@@ -173,17 +173,16 @@
     return QGraphicsRectItem::mouseMoveEvent(event);
 
   QPointF p = event->pos();
-  QPointF l = event->lastPos();
   QPointF s = event->scenePos();
 
   if (gripMode() == ViewItem::Resize) {
     switch(activeGrip()) {
     case RightMidGrip:
-      resizeRight(p.x() - l.x());
+      resizeRight(p.x() - rightMidGrip().controlPointRect().center().x());
       rotateTowards(rightMidGrip().controlPointRect().center(), p);
       break;
     case LeftMidGrip:
-      resizeLeft(p.x() - l.x());
+      resizeLeft(p.x() - leftMidGrip().controlPointRect().center().x());
       rotateTowards(leftMidGrip().controlPointRect().center(), p);
       break;
     default:
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #968484:968485
@@ -921,7 +921,6 @@
     return QGraphicsRectItem::mouseMoveEvent(event);
 
   QPointF p = event->pos();
-  QPointF l = event->lastPos();
   QPointF s = event->scenePos();
 
   if (gripMode() == ViewItem::Rotate) {
@@ -949,21 +948,21 @@
 
     switch(_activeGrip) {
     case TopLeftGrip:
-        resizeTopLeft(p - l); break;
+        resizeTopLeft(p - topLeftGrip().controlPointRect().center()); break;
     case TopRightGrip:
-        resizeTopRight(p - l); break;
+        resizeTopRight(p - topRightGrip().controlPointRect().center()); break;
     case BottomRightGrip:
-        resizeBottomRight(p - l); break;
+        resizeBottomRight(p - bottomRightGrip().controlPointRect().center()); break;
     case BottomLeftGrip:
-        resizeBottomLeft(p - l); break;
+        resizeBottomLeft(p - bottomLeftGrip().controlPointRect().center()); break;
     case TopMidGrip:
-        resizeTop(p.y() - l.y()); break;
+        resizeTop(p.y() - topMidGrip().controlPointRect().center().y()); break;
     case RightMidGrip:
-        resizeRight(p.x() - l.x()); break;
+        resizeRight(p.x() - rightMidGrip().controlPointRect().center().x()); break;
     case BottomMidGrip:
-        resizeBottom(p.y() - l.y()); break;
+        resizeBottom(p.y() - bottomMidGrip().controlPointRect().center().y()); break;
     case LeftMidGrip:
-        resizeLeft(p.x() - l.x()); break;
+        resizeLeft(p.x() - leftMidGrip().controlPointRect().center().x()); break;
     case NoGrip:
       break;
     }


More information about the Kst mailing list