[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Tue Oct 11 04:29:31 CEST 2005


SVN commit 469400 by staikos:

fix painting of XY guidelines.  There are still cases that break.  Testcases
will be appreciated.


 M  +11 -5     kst2dplot.cpp  
 M  +1 -0      kst2dplot.h  


--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #469399:469400
@@ -2249,6 +2249,7 @@
   KstMouseModeType gzType = globalZoomType();
   if (gzType == X_ZOOMBOX || gzType == Y_ZOOMBOX) {
     updateXYGuideline(KstApp::inst()->activeView()->widget(), QPoint(-1, -1), KstApp::inst()->activeView()->widget()->mapFromGlobal(QCursor::pos()), GetPlotRegion(), gzType);
+    _mouse.lastGuideline = KstApp::inst()->activeView()->widget()->mapFromGlobal(QCursor::pos());
   }
   KstPlotBase::paint(type, p);
 }
@@ -3777,14 +3778,19 @@
     updateTieBox(p);
   }
 
-  QPoint oldPos = _mouse.tracker;
   _mouse.tracker = e->pos();
   QRect pr = GetPlotRegion();
   
   KstMouseModeType gzType = globalZoomType();
   // Draw a helper guide in X or Y zoom modes
-  if (e->state() == 0 && (gzType == X_ZOOMBOX || gzType == Y_ZOOMBOX)) {
-    updateXYGuideline(view, oldPos, _mouse.tracker, pr, gzType);
+  if (gzType == X_ZOOMBOX || gzType == Y_ZOOMBOX) {
+    if (e->state() == 0) {
+      updateXYGuideline(view, _mouse.lastGuideline, _mouse.tracker, pr, gzType);
+      _mouse.lastGuideline = _mouse.tracker;
+    } else {
+      updateXYGuideline(view, _mouse.lastGuideline, QPoint(-1, -1), pr, gzType);
+      _mouse.lastGuideline = QPoint(-1, -1);
+    }
   }
 
   if (e->state() & Qt::LeftButton && legendUnder(e)) {
@@ -4113,13 +4119,13 @@
 }
 
 
-KstMouse::KstMouse()
-{
+KstMouse::KstMouse() {
   mode = INACTIVE;
   label = -1;
   minMove = 2;
   lastLocation = QPoint(-1, -1);
   tracker = QPoint(-1, -1);
+  lastGuideline = QPoint(-1, -1);
 }
 
 
--- trunk/extragear/graphics/kst/kst/kst2dplot.h #469399:469400
@@ -71,6 +71,7 @@
   int label, minMove;
   QPoint lastLocation, pressLocation;  // for zooming primarily
   QPoint tracker; // for tracking the mouse location
+  QPoint lastGuideline; // for tracking the last guideline location
   QRect plotGeometry;
   bool zooming() const;
   void zoomStart(KstMouseModeType t, const QPoint& location);


More information about the Kst mailing list