[Kst] extragear/graphics/kst/src/libkstapp

Duncan Hanson duncan.hanson at gmail.com
Mon May 8 22:38:01 CEST 2006


SVN commit 538780 by dhanson:

BUG:125299 fixed- copy and paste from the XY_ZOOMBOX case.

 M  +21 -9     kst2dplot.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kst2dplot.cpp #538779:538780
@@ -3688,6 +3688,7 @@
       i_near_x = (*i)->getIndexNearXY(xpos, dx_per_pix, ypos);
       (*i)->point(i_near_x, near_x, near_y);
       distance = fabs(ypos - near_y);
+      
       if (distance < best_distance || !rc ) {
         newypos = near_y;
         newxpos = near_x;
@@ -4145,11 +4146,17 @@
 
       getLScale(xmin, ymin, xmax, ymax);
       plotregion = GetPlotRegion();
-      new_ymin = (double)(newg.bottom() - plotregion.top() + 1) /
-                 (double)plotregion.height() * (ymin - ymax) + ymax;
-      new_ymax = (double)(newg.top() - plotregion.top()) /
-                 (double)plotregion.height() * (ymin - ymax) + ymax;
 
+      if (_yReversed) {
+        new_ymin = (double)(plotregion.bottom() - newg.top() + 1);
+        new_ymax = (double)(plotregion.bottom() - newg.bottom());
+      } else {
+        new_ymin = (double)(newg.bottom() - plotregion.top() + 1);
+        new_ymax = (double)(newg.top() - plotregion.top());
+      }
+      new_ymin = new_ymin/(double)plotregion.height() * (ymin - ymax) + ymax;
+      new_ymax = new_ymax/(double)plotregion.height() * (ymin - ymax) + ymax;
+
       setYScaleMode(FIXED);
       if (setLYScale(new_ymin, new_ymax)) {
         pushScale();
@@ -4169,12 +4176,17 @@
 
       getLScale(xmin, ymin, xmax, ymax);
       plotregion = GetPlotRegion();
-      new_xmin = (double)(newg.left() - plotregion.left()) /
-                 (double)plotregion.width() * (xmax - xmin) + xmin;
-      new_xmax = (double)(newg.right() -
-                          plotregion.left() + 1) /
-                 (double)plotregion.width() * (xmax - xmin) + xmin;
 
+      if (_xReversed) {
+        new_xmin = (double)(plotregion.right() - newg.right());
+        new_xmax = (double)(plotregion.right() - newg.left() + 1);
+      } else {
+        new_xmin = (double)(newg.left() - plotregion.left());
+        new_xmax = (double)(newg.right() - plotregion.left() + 1);
+      }
+      new_xmin = new_xmin/(double)plotregion.width() * (xmax - xmin) + xmin;
+      new_xmax = new_xmax/(double)plotregion.width() * (xmax - xmin) + xmin;
+
       setXScaleMode(FIXED);
       if (setLXScale(new_xmin, new_xmax)) {
         pushScale();


More information about the Kst mailing list