Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added stroke width for "empty" pie #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added stroke width for "empty" pie
  • Loading branch information
uaoleg committed Aug 17, 2015
commit 5bd8b88a0ef09988911aa2c0ea9f3f20ee907f85
10 changes: 8 additions & 2 deletions angular-progress-arc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
attr[key] = value;
}
});
if (!attr.strokeWidthBg) {
attr.strokeWidthBg = attr.strokeWidth;
}
};
};
});
Expand All @@ -35,6 +38,7 @@
scope: {
size: '@', // Size of element in pixels.
strokeWidth: '@', // Width of progress arc stroke.
strokeWidthBg: '@', // Width of progress arc stroke.
stroke: '@', // Color/appearance of stroke.
counterClockwise: '@', // Boolean value indicating
complete: '&', // Expression evaluating to float [0.0, 1.0]
Expand All @@ -50,7 +54,9 @@
scope.offset = /firefox/i.test(navigator.userAgent) ? -89.9 : -90;
var updateRadius = function () {
scope.strokeWidthCapped = Math.min(scope.strokeWidth, scope.size / 2 - 1);
scope.strokeWidthCappedBg = Math.min(scope.strokeWidthBg, scope.size / 2 - 1);
scope.radius = Math.max((scope.size - scope.strokeWidthCapped) / 2 - 1, 0);
scope.radiusBg = Math.max((scope.size - scope.strokeWidthCappedBg) / 2 - 1, 0);
scope.circumference = 2 * Math.PI * scope.radius;
};
scope.$watchCollection('[size, strokeWidth]', updateRadius);
Expand All @@ -63,9 +69,9 @@
'ng-if="background" ' +
'ng-attr-cx="{{size/2}}" ' +
'ng-attr-cy="{{size/2}}" ' +
'ng-attr-r="{{radius}}" ' +
'ng-attr-r="{{radiusBg}}" ' +
'ng-attr-stroke="{{background}}" ' +
'ng-attr-stroke-width="{{strokeWidthCapped}}"' +
'ng-attr-stroke-width="{{strokeWidthCappedBg}}"' +
'/>' +
'<circle class="ngpa-progress" fill="none" ' +
'ng-attr-cx="{{size/2}}" ' +
Expand Down