File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
lib/java/com/google/android/material/loadingindicator Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 3232import androidx .graphics .shapes .RoundedPolygon ;
3333import androidx .graphics .shapes .Shapes_androidKt ;
3434import com .google .android .material .color .MaterialColors ;
35+ import com .google .android .material .math .MathUtils ;
3536import com .google .android .material .shape .MaterialShapes ;
3637
3738class LoadingIndicatorDrawingDelegate {
@@ -116,9 +117,10 @@ void drawIndicator(
116117 canvas .rotate (indicatorState .rotationDegree );
117118 // Draws the shape morph.
118119 indicatorPath .rewind ();
120+ int shapeMorphFraction = (int ) Math .floor (indicatorState .morphFraction );
119121 int fractionAmongAllShapes =
120- ( int ) ( indicatorState . morphFraction % INDETERMINATE_MORPH_SEQUENCE .length );
121- float fractionPerShape = indicatorState .morphFraction % 1 ;
122+ MathUtils . floorMod ( shapeMorphFraction , INDETERMINATE_MORPH_SEQUENCE .length );
123+ float fractionPerShape = indicatorState .morphFraction - shapeMorphFraction ;
122124 Shapes_androidKt .toPath (
123125 INDETERMINATE_MORPH_SEQUENCE [fractionAmongAllShapes ], fractionPerShape , indicatorPath );
124126 // We need to apply the scaling to the path directly, instead of on the canvas, to avoid the
You can’t perform that action at this time.
0 commit comments