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

Duncan Hanson duncan.hanson at gmail.com
Mon Apr 30 21:20:20 CEST 2007


SVN commit 659768 by dhanson:

CCBUG:143804 most straightforward solution-- non-centered resizing of ellipses when edges are dragged.

 M  +5 -12     kstviewellipse.cpp  


--- branches/work/kst/1.5/kst/src/libkstapp/kstviewellipse.cpp #659767:659768
@@ -95,22 +95,15 @@
     }
   }
 
-  const QRect g(geometry());
-  int bw(_borderWidth * p.lineWidthAdjustmentFactor());
-  if (bw > g.width()/2) {
-    bw = g.width()/2;
-  }
-  if (bw > g.height()/2) {
-    bw = g.height()/2;
-  }
+  const int bw(_borderWidth * p.lineWidthAdjustmentFactor());
   QPen pen(bw > 0 ? _borderColor : _foregroundColor, bw);
   p.setPen(pen);
   if (_transparentFill) {
-    p.setBrush(Qt::NoBrush);
+    p.setBrush(Qt::NoBrush);  
   } else {
     p.setBrush(_foregroundColor);
   }
-
+  const QRect g(geometry());
   p.drawEllipse(g.x() + bw/2, g.y() + bw/2, g.width() - bw, g.height() - bw);
   p.restore();
 }
@@ -185,8 +178,8 @@
 
 signed int KstViewEllipse::directionFor(const QPoint& pos) {
   signed int direction = KstViewObject::directionFor(pos);
-  if (direction != 0) {
-    // not moving, so in any resize direction, we want it centred
+  if (!(((direction & (UP|DOWN)) == 0) || ((direction & (LEFT|RIGHT)) == 0))) {
+    // not an edge.
     direction |= CENTEREDRESIZE;  
   }  
   return direction;


More information about the Kst mailing list