Skip to content

Commit

Permalink
fix(progress-circular): show correct circle arc when changing from in…
Browse files Browse the repository at this point in the history
…determinate to determinate mode (angular#11580)
  • Loading branch information
marosoft authored and josephperrott committed Mar 6, 2019
1 parent 3cf4d74 commit 686b365
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/components/progressCircular/js/progressCircularDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ function MdProgressCircularDirective($window, $mdProgressCircular, $mdTheming,
var mode = newValues[1];
var isDisabled = newValues[2];
var wasDisabled = oldValues[2];
var diameter = 0;
var strokeWidth = 0;

if (isDisabled !== wasDisabled) {
element.toggleClass(DISABLED_CLASS, !!isDisabled);
Expand All @@ -153,14 +155,28 @@ function MdProgressCircularDirective($window, $mdProgressCircular, $mdTheming,
}

if (mode === MODE_INDETERMINATE) {
if (oldValues[1] === MODE_DETERMINATE) {
diameter = getSize(scope.mdDiameter);
strokeWidth = getStroke(diameter);
path.attr('d', getSvgArc(diameter, strokeWidth, true));
path.attr('stroke-dasharray', (diameter - strokeWidth) * $window.Math.PI * 0.75);
}
startIndeterminateAnimation();
} else {
var newValue = clamp(newValues[0]);
var oldValue = clamp(oldValues[0]);

cleanupIndeterminateAnimation();

if (oldValues[1] === MODE_INDETERMINATE) {
diameter = getSize(scope.mdDiameter);
strokeWidth = getStroke(diameter);
path.attr('d', getSvgArc(diameter, strokeWidth, false));
path.attr('stroke-dasharray', (diameter - strokeWidth) * $window.Math.PI);
}

element.attr('aria-valuenow', newValue);
renderCircle(clamp(oldValues[0]), newValue);
renderCircle(oldValue, newValue);
}
}

Expand Down

0 comments on commit 686b365

Please sign in to comment.