Skip to content

Commit

Permalink
椭圆进度优化
Browse files Browse the repository at this point in the history
  • Loading branch information
liyujiang-gzu committed Sep 9, 2021
1 parent 8b4bb28 commit 5a04cc0
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,21 +244,25 @@ private void drawReachedBar(Canvas canvas, float reachedEndX) {
canvas.drawLine(0, 0, reachedEndX, 0, mPaint);
return;
}
if (mCutCorner == CUT_CORNER_PARALLELOGRAM && reachedEndX < mBarHeight) {
if (mCutCorner == CUT_CORNER_PARALLELOGRAM && reachedEndX < mReachedBarHeight) {
return;
}
mPaint.setStrokeWidth(0);
int barGap = mUnReachedBarHeight - mReachedBarHeight;
int reachedBarHeight = mReachedBarHeight;
if (mCutCorner == CUT_CORNER_ELLIPSE && reachedEndX < mReachedBarHeight) {
reachedBarHeight = (int) reachedEndX;
}
int barGap = mUnReachedBarHeight - reachedBarHeight;
if (mCutCorner == CUT_CORNER_ELLIPSE) {
barGap = barGap / 2;
}
float top = -1 * mBarHeight / 2f + Math.max(0, barGap);
mRectF.set(0, top, reachedEndX, mReachedBarHeight + top);
mRectF.set(0, top, reachedEndX, reachedBarHeight + top);
Path path;
if (mCutCorner == CUT_CORNER_PARALLELOGRAM) {
path = generateParallelogram(mRectF, mReachedBarHeight);
path = generateParallelogram(mRectF, reachedBarHeight);
} else {
path = generateEllipse(mRectF, mReachedBarHeight);
path = generateEllipse(mRectF, reachedBarHeight);
}
canvas.drawPath(path, mPaint);
}
Expand Down

0 comments on commit 5a04cc0

Please sign in to comment.