[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Sat Dec 10 02:06:51 CET 2005


SVN commit 487290 by staikos:

make horizontal and vertical lines work a bit better, and don't divide by zero.
I noticed that saving and loading of arrows and lines doesn't work.


 M  +6 -5      kstviewline.cpp  


--- trunk/extragear/graphics/kst/kst/kstviewline.cpp #487289:487290
@@ -72,7 +72,7 @@
   
   // Adjust for large widths.  We don't want the line clipped because it goes
   // out of the bounding box.
-  if (_width > 1) {
+  if (_width > 1 && geom.height() > 0) {
     double theta = atan(geom.width()/geom.height());
     int w = _width;
     if (theta >= 0 && theta <= M_PI/4) {
@@ -162,6 +162,7 @@
 void KstViewLine::setWidth(int width) {
   if (_width != width) {
     _width = width;
+    updateOrientation();
     setDirty();
   }
 }
@@ -203,21 +204,21 @@
     if (_from.y() < _to.y()) {
       _orientation = DownRight;  
       move(_from);
-      resize(QSize(_to.x() - _from.x() + 1, _to.y() - _from.y() + 1));
+      resize(QSize(kMax(_width, _to.x() - _from.x() + 1), kMax(_width, _to.y() - _from.y() + 1)));
     } else {
       _orientation = UpRight;  
       move(QPoint(_from.x(), _to.y()));
-      resize(QSize(_to.x() - _from.x() + 1, _from.y() - _to.y() + 1));
+      resize(QSize(kMax(_width, _to.x() - _from.x() + 1), kMax(_width, _from.y() - _to.y() + 1)));
     }
   } else {
     if (_from.y() < _to.y()) {
       _orientation = DownLeft;  
       move(QPoint(_to.x(), _from.y()));
-      resize(QSize(_from.x() - _to.x() + 1, _to.y() - _from.y() + 1));
+      resize(QSize(kMax(_width, _from.x() - _to.x() + 1), kMax(_width, _to.y() - _from.y() + 1)));
     } else {
       _orientation = UpLeft;  
       move(_to);
-      resize(QSize(_from.x() - _to.x() + 1, _from.y() - _to.y() + 1));
+      resize(QSize(kMax(_width, _from.x() - _to.x() + 1), kMax(_width, _from.y() - _to.y() + 1)));
     }
   }
 }


More information about the Kst mailing list