Skip to content

Commit

Permalink
fixes #377
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelcobain committed Jul 26, 2017
1 parent a065f67 commit 9bee043
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
30 changes: 6 additions & 24 deletions addon/components/paper-progress-linear.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ export default Component.extend(ColorMixin, {

constants: inject.service(),

init() {
this._super(...arguments);
this.setupTransforms();
},

mode: computed('value', function() {
let value = this.get('value');
let bufferValue = this.get('bufferValue');
Expand All @@ -54,36 +49,23 @@ export default Component.extend(ColorMixin, {

queryModeClass: computed('mode', function() {
let mode = this.get('mode');

switch (mode) {
case MODE_QUERY:
case MODE_BUFFER:
case MODE_DETERMINATE:
case MODE_INDETERMINATE:
return `md-mode-${mode}`;
default:
return '';
if ([MODE_QUERY, MODE_BUFFER, MODE_DETERMINATE, MODE_INDETERMINATE].includes(mode)) {
return `md-mode-${mode}`;
} else {
return '';
}
}),

transforms: new Array(101),

setupTransforms() {
for (let i = 0; i < 101; i++) {
this.transforms[i] = makeTransform(i);
}
},

bar1Style: computed('clampedBufferValue', function() {
return htmlSafe(`${this.get('constants.CSS.TRANSFORM')}: ${this.transforms[this.get('clampedBufferValue')]}`);
return htmlSafe(`${this.get('constants.CSS.TRANSFORM')}: ${makeTransform(this.get('clampedBufferValue'))}`);
}),

bar2Style: computed('clampedValue', 'mode', function() {
if (this.get('mode') === MODE_QUERY) {
return htmlSafe('');
}

return htmlSafe(`${this.get('constants.CSS.TRANSFORM')}: ${this.transforms[this.get('clampedValue')]}`);
return htmlSafe(`${this.get('constants.CSS.TRANSFORM')}: ${makeTransform(this.get('clampedValue'))}`);
}),

clampedValue: computed('value', function() {
Expand Down
1 change: 1 addition & 0 deletions tests/dummy/app/controllers/demo/progress-linear.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default Controller.extend({
this.set('timer2', run.later(this, function() {
this.set('mode', this.get('mode') === 'query' ? 'determinate' : 'query');
this.set('determinateValue', 30);
this.set('determinateValue2', 30);
run.later(this, this.setupTimer2);
}, 7200));
},
Expand Down

0 comments on commit 9bee043

Please sign in to comment.