Version: 1.2.1 (using KDE KDE 3.5.1) Installed from: Fedora RPMs OS: Linux Example: Plot an image (fits image, for example). Reverse one of the axes (like the x axis). Zoom into a part of the plot with either x zoom mode or y zoom mode. Note how it zoomed into the wrong region (nearly opposite of what you wanted). xy zoom seems to work correctly. If you un-reverse the axis, further zooming will work ok.
fixed- copy and paste from the XY_ZOOMBOX case in Kst2DPlot::mouseReleaseEvent. I don't have the permission bits to close this bug right now. I will do it when I get them.
*** Bug has been marked as fixed ***.
This bug can still apply if axes are logarithmic.
SVN commit 549185 by dhanson: CCBUG:125299 partial fix. change the way that dx_per_pix is calculated slightly. redo calculation of dy_per_pix. there will still be problems with 1) clicking on lines in logarithmic graphs. I don't see an easy way to solve this. M +19 -10 kst2dplot.cpp --- trunk/extragear/graphics/kst/src/libkstapp/kst2dplot.cpp #549184:549185 @@ -6081,6 +6081,7 @@ void Kst2DPlot::mouseDoubleClickEvent(QWidget *view, QMouseEvent *e) { + // allow user to edit a curve if click was close enough. Q_UNUSED(view) KstBaseCurvePtr curve; QRect pr = GetPlotRegion(); @@ -6091,28 +6092,36 @@ getCursorPos(pos, xpos, ypos, xmin, xmax, ymin, ymax); - // convert 1 pixel to plot units. - double dx_per_pix = double(pos.x() + 2 - pr.left()) / double(pr.width()) * (xmax - xmin) + xmin; - if (isXLog()) { - dx_per_pix = pow(_xLogBase, dx_per_pix); + // calculate max x distance. + double dx_per_pix; + if (!isXLog()) { + dx_per_pix = (xmax - xmin)/pr.width(); + } else { + dx_per_pix = xpos*log(_xLogBase)*(xmax - xmin)/pr.width(); } - dx_per_pix -= xpos; - double dx = 5*dx_per_pix; + double dx = fabs(5.0*dx_per_pix); //~5 pixels. + // calculate max y distance. + double dy_per_pix; + if (!isYLog()) { + dy_per_pix = (ymin - ymax)/pr.height(); + } else { + dy_per_pix = ypos*log(_yLogBase)*(ymin - ymax)/pr.height(); + } + double dy = fabs(5.0*dy_per_pix); //~5 pixels. + for (KstBaseCurveList::Iterator i = Curves.begin(); i != Curves.end(); ++i) { (*i)->readLock(); double distance = (*i)->distanceToPoint(xpos, dx, ypos); (*i)->readUnlock(); - if (isYLog()) { - distance = log(distance); - } + if (distance < best_distance || !curve) { best_distance = distance; curve = *i; } } - if (curve && fabs(best_distance * pr.height() / (ymax - ymin)) <= 5) { + if (curve && fabs(best_distance) <= dy) { curve->readLock(); KstDataObjectPtr provider = curve->providerDataObject(); if (provider) {
last two comments actually apply to BUG117822.