Skip to content

Commit

Permalink
Fix for rounding error at the edges
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Nov 26, 2015
1 parent dd3bd71 commit 8e93478
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ public int getLowestVisibleXIndex() {
mViewPortHandler.contentLeft(), mViewPortHandler.contentBottom()
};
getTransformer(AxisDependency.LEFT).pixelsToValue(pts);
return (pts[0] <= 0) ? 0 : (int) (pts[0] + 1);
return (pts[0] <= 0) ? 0 : (int) Math.round(pts[0] + 1.0f);
}

/**
Expand All @@ -1274,7 +1274,9 @@ public int getHighestVisibleXIndex() {
mViewPortHandler.contentRight(), mViewPortHandler.contentBottom()
};
getTransformer(AxisDependency.LEFT).pixelsToValue(pts);
return (pts[0] >= mData.getXValCount()) ? mData.getXValCount() - 1 : (int) pts[0];
return (Math.round(pts[0]) >= mData.getXValCount()) ?
mData.getXValCount() - 1 :
(int) Math.round(pts[0]);
}

/**
Expand Down

0 comments on commit 8e93478

Please sign in to comment.