Mercurial > hg > svgui
diff layer/SliceLayer.cpp @ 1256:5a10e9d924d4
Make some corrections to crosshair (measure cursor) positioning and feature descriptions. Needs review.
author | Chris Cannam |
---|---|
date | Tue, 07 Mar 2017 18:54:15 +0000 |
parents | bbdfe9b57857 |
children | 5bab9562eaa3 |
line wrap: on
line diff
--- a/layer/SliceLayer.cpp Tue Mar 07 18:39:37 2017 +0000 +++ b/layer/SliceLayer.cpp Tue Mar 07 18:54:15 2017 +0000 @@ -115,8 +115,8 @@ maxbin = 0; if (!m_sliceableModel) return ""; - minbin = int(round(getBinForX(v, p.x()))); - maxbin = int(round(getBinForX(v, p.x() + 1))); + minbin = int(getBinForX(v, p.x())); + maxbin = int(getBinForX(v, p.x() + 1)); int mh = m_sliceableModel->getHeight(); if (minbin >= mh) minbin = mh - 1; @@ -237,19 +237,21 @@ x = x - origin; if (x < 0) x = 0; + + double eps = 1e-10; switch (m_binScale) { case LinearBins: - bin = int((x * count) / w + 0.0001); + bin = (x * count) / w + eps; break; case LogBins: - bin = int(pow(10.0, (x * log10(count + 1)) / w) - 1 + 0.0001); + bin = pow(10.0, (x * log10(count + 1)) / w) - 1.0 + eps; break; case InvertedLogBins: - bin = count + 1 - int(pow(10.0, (log10(count) * (w - x)) / double(w)) + 0.0001); + bin = count + 1 - pow(10.0, (log10(count) * (w - x)) / double(w)) + eps; break; }