Bug 95413

Summary: Datamode no longer working when zooming
Product: [Applications] kst Reporter: Andrew Walker <arwalker>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Andrew Walker 2004-12-18 21:37:59 UTC
Version:           CVS_HEAD (using KDE KDE 3.2.1)
OS:                Linux

STEPS TO REPRODUCE:

Create a plot.
Enter datamode.
Move the cursor to a point in the plor where the datamode marker is visible.
Zoom into the plot using the left mouse button and drag.

RESULTS:

The datamode marker remains where it is.

EXPECTED RESULTS:

The datamode marker should move to the point now closest to the cursor.
Comment 1 Netterfield 2004-12-18 22:15:43 UTC
It appears that whenever you change the x range of a plot (zooming, 
scrolling...) but don't move the mouse, the data mode cursor pops to a 
position 1/3 of the way from the left.  As soon as you move the mouse, the 
marker moves to the mouse.

The behaviour is odd, but not disasterous, and has probably happened because 
of some recent speed enhancements.  Make sure that any fixes do not loose the 
speed enhancement.

cbn

Comment 2 George Staikos 2004-12-20 02:20:34 UTC
CVS commit by staikos: 

Update the datamode marker when scrolling and zooming
BUG: 95413, 95412


  M +12 -5     kst2dplot.cpp   1.336
  M +2 -1      kst2dplot.h   1.130


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.335:1.336
@@ -1956,8 +1956,8 @@ void Kst2DPlot::paint(KstPaintType type,
         if (view) {
           _copy_x = _copy_y = KST::NOPOINT;
-          if (GetPlotRegion().contains(_mouse.lastLocation)) {
-            updateMousePos(_mouse.lastLocation);
+          if (GetPlotRegion().contains(_mouse.tracker)) {
+            updateMousePos(_mouse.tracker);
             if (KstApp::inst()->dataMode()) {
-              highlightNearestDataPoint(false, view, _mouse.lastLocation);
+              highlightNearestDataPoint(false, view, _mouse.tracker);
             }
           }
@@ -2954,5 +2954,5 @@ bool Kst2DPlot::mouseHandler() const {
 
 void Kst2DPlot::removeFocus(QPainter& p) {
-  _mouse.lastLocation = QPoint(-1, -1);
+  _mouse.tracker = _mouse.lastLocation = QPoint(-1, -1);
   p.setClipRegion(_lastClipRegion);
   setHasFocus(false);
@@ -3159,4 +3159,6 @@ void Kst2DPlot::mouseMoveEvent(QWidget *
   }
 
+  _mouse.tracker = e->pos();
+
   if (globalZoomType() == LABEL_TOOL) { // HACK
     _mouse.mode = LABEL_TOOL;
@@ -3432,4 +3434,6 @@ void Kst2DPlot::mouseReleaseEvent(QWidge
   static_cast<KstViewWidget*>(view)->viewObject()->releaseMouse(this);
 
+  _mouse.tracker = e->pos();
+
   QRect newg = _mouse.mouseRect();
   if (_mouse.mode == XY_ZOOMBOX) {
@@ -3574,4 +3578,5 @@ KstMouse::KstMouse()
   minMove = 2;
   lastLocation = QPoint(-1, -1);
+  tracker = QPoint(-1, -1);
 }
 
@@ -3638,5 +3643,5 @@ void Kst2DPlot::zoomRectUpdate(QWidget *
 void Kst2DPlot::setCursorForMode(QWidget *view) {
   Q_ASSERT(false);
-  setCursorForMode(view, _mouse.mode, _mouse.lastLocation);
+  setCursorForMode(view, _mouse.mode, _mouse.tracker);
 }
 
@@ -4588,4 +4593,6 @@ void Kst2DPlot::dropEvent(QWidget *view,
   }
 
+  _mouse.tracker = e->pos();
+
   if (accept) {
     KstApp::inst()->document()->setModified();

--- kdeextragear-2/kst/kst/kst2dplot.h  #1.129:1.130
@@ -61,5 +61,6 @@ struct KstMouse {
   KstMouseModeType mode;
   int label, minMove;
-  QPoint lastLocation, pressLocation;
+  QPoint lastLocation, pressLocation;  // for zooming primarily
+  QPoint tracker; // for tracking the mouse location
   QRect plotGeometry;
   bool zooming() const;