Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

Commit

Permalink
Fixed #364 that the stroke width did not join to calculation of circl…
Browse files Browse the repository at this point in the history
…e center and layout width and height.
  • Loading branch information
msdx committed Aug 19, 2015
1 parent 4b78425 commit 40af4ad
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ protected void onDraw(Canvas canvas) {
}

final float threeRadius = mRadius * 3 + mGap;
final float shortOffset = shortPaddingBefore + mRadius;
float longOffset = longPaddingBefore + mRadius;
final float shortOffset = shortPaddingBefore + mRadius + mPaintStroke.getStrokeWidth() / 2;
float longOffset = longPaddingBefore + mRadius + mPaintStroke.getStrokeWidth() / 2;
if (mCentered) {
longOffset += ((longSize - longPaddingBefore - longPaddingAfter) - (count * threeRadius - mRadius - mGap)) / 2.0f;
}
Expand Down Expand Up @@ -481,7 +481,8 @@ private int measureLong(int measureSpec) {
//Calculate the width according the views count
final int count = mViewPager.getAdapter().getCount();
result = (int)(getPaddingLeft() + getPaddingRight()
+ (count * (2 * mRadius + 1)) + (count - 1) * (mRadius + mGap));
+ (count * (2 * mRadius + 1)) + (count - 1) * (mRadius + mGap)
+ mPaintStroke.getStrokeWidth()); // The first circle half stroke + the last one half stroke
//Respect AT_MOST value if that was what is called for by measureSpec
if (specMode == MeasureSpec.AT_MOST) {
result = Math.min(result, specSize);
Expand All @@ -507,7 +508,8 @@ private int measureShort(int measureSpec) {
result = specSize;
} else {
//Measure the height
result = (int)(2 * mRadius + getPaddingTop() + getPaddingBottom() + 1);
result = (int)(2 * mRadius + getPaddingTop() + getPaddingBottom() + 1
+ mPaintStroke.getStrokeWidth()); // The first circle half stroke + the last one half stroke
//Respect AT_MOST value if that was what is called for by measureSpec
if (specMode == MeasureSpec.AT_MOST) {
result = Math.min(result, specSize);
Expand Down

0 comments on commit 40af4ad

Please sign in to comment.