2018-09-25 16:28:26 +00:00
|
|
|
import Component from '@ember/component';
|
|
|
|
import { computed } from '@ember/object';
|
2018-06-26 21:35:47 +00:00
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
export default Component.extend({
|
2018-06-26 21:35:47 +00:00
|
|
|
'data-test-radial-progress': true,
|
|
|
|
tagName: 'svg',
|
|
|
|
classNames: 'radial-progress',
|
|
|
|
attributeBindings: ['size:width', 'size:height', 'viewBox'],
|
|
|
|
progressDecimal: null,
|
|
|
|
size: 20,
|
|
|
|
strokeWidth: 1,
|
|
|
|
|
|
|
|
viewBox: computed('size', function() {
|
|
|
|
let s = this.get('size');
|
|
|
|
return `0 0 ${s} ${s}`;
|
|
|
|
}),
|
|
|
|
centerValue: computed('size', function() {
|
|
|
|
return this.get('size') / 2;
|
|
|
|
}),
|
|
|
|
r: computed('size', 'strokeWidth', function() {
|
|
|
|
return (this.get('size') - this.get('strokeWidth')) / 2;
|
|
|
|
}),
|
|
|
|
c: computed('r', function() {
|
|
|
|
return 2 * Math.PI * this.get('r');
|
|
|
|
}),
|
|
|
|
dashArrayOffset: computed('c', 'progressDecimal', function() {
|
|
|
|
return this.get('c') * (1 - this.get('progressDecimal'));
|
|
|
|
}),
|
|
|
|
});
|