Skip to content

Commit 0a5d306

Browse files
author
gaopengfei
committed
fix getWidth() sometime return 0 bug
1 parent e3b3cd2 commit 0a5d306

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/src/main/java/io/feeeei/circleseekbar/CircleSeekBar.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ private void refershPosition() {
312312

313313
private float calcXLocationInWheel(double angle, double cos) {
314314
if (angle < 180) {
315-
return (float) (getWidth() / 2 + Math.sqrt(1 - cos * cos) * mUnreachedRadius);
315+
return (float) (getMeasuredWidth() / 2 + Math.sqrt(1 - cos * cos) * mUnreachedRadius);
316316
} else {
317-
return (float) (getWidth() / 2 - Math.sqrt(1 - cos * cos) * mUnreachedRadius);
317+
return (float) (getMeasuredWidth() / 2 - Math.sqrt(1 - cos * cos) * mUnreachedRadius);
318318
}
319319
}
320320

0 commit comments

Comments
 (0)