Skip to content

Commit

Permalink
[ProgressIndicator] Updated the setter of track thickness to not upda…
Browse files Browse the repository at this point in the history
…te track corner radius.

PiperOrigin-RevId: 601245058
(cherry picked from commit 9c21612)
  • Loading branch information
pekingme authored and hunterstich committed Mar 21, 2024
1 parent dcd4f96 commit 540f5ee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ public int getTrackThickness() {
public void setTrackThickness(@Px int trackThickness) {
if (spec.trackThickness != trackThickness) {
spec.trackThickness = trackThickness;
spec.trackCornerRadius = min(spec.trackCornerRadius, spec.trackThickness / 2);
requestLayout();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ void adjustCanvas(
// These are used when drawing the indicator and track.
useStrokeCap = spec.trackThickness / 2 <= spec.trackCornerRadius;
displayedTrackThickness = spec.trackThickness * trackThicknessFraction;
displayedCornerRadius = spec.trackCornerRadius * trackThicknessFraction;
displayedCornerRadius =
min(spec.trackThickness / 2, spec.trackCornerRadius) * trackThicknessFraction;
adjustedRadius = (spec.indicatorSize - spec.trackThickness) / 2f;
if ((isShowing && spec.showAnimationBehavior == CircularProgressIndicator.SHOW_INWARD)
|| (isHiding && spec.hideAnimationBehavior == CircularProgressIndicator.HIDE_OUTWARD)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ void adjustCanvas(

// These are set for the drawing the indicator and track.
displayedTrackThickness = spec.trackThickness * trackThicknessFraction;
displayedCornerRadius = spec.trackCornerRadius * trackThicknessFraction;
displayedCornerRadius =
min(spec.trackThickness / 2, spec.trackCornerRadius) * trackThicknessFraction;

// Clips all drawing to the track area, so it doesn't draw outside of its bounds (which can
// happen in certain configurations of clipToPadding and clipChildren)
Expand Down

0 comments on commit 540f5ee

Please sign in to comment.