Components: Add option to reset md-progress-bar value without animation

Created on 8 Mar 2017  路  6Comments  路  Source: angular/components

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

When resetting the value of an md-progress-bar to 0 (starting a new task), the bar jumps directly to zero and increases from there.

What is the current behavior?

The bar slides backwards towards zero and starts increasing from wherever the animation reached.

What are the steps to reproduce?

http://plnkr.co/edit/XsN52k?p=preview

What is the use-case or motivation for changing an existing behavior?

It seems reasonable to reuse a progress bar, say, to indicate background loads of map tiles. The current behavior creates the visual impression that the progress bar is re-estimating the time for an already-ongoing task, rather than tracking a new one.

Possibly, a reasonable behavior would be to never use animation when setting the value to 0. This is a bit of a "magic corner case" but I think it would be what people intuitively expects.

Which versions of Angular, Material, OS, browsers are affected?

Angular Material 2.0.0 beta 2

Is there anything else we should know?

feature needs discussion

Most helpful comment

Does this currently have a workaround or something?

All 6 comments

Took a look at your code, there were some things that looked out of place.
this.percentage was not being reset to 0 when you clicked the button and when the 'download' finished.
and you were not removing this.timerHandle if you re-clicked the button.

http://plnkr.co/edit/7CwGk99baBS6tO0KL6qW?p=preview

I tried to keep the code to an absolute minimum to show the "animated slide back" behavior as the salient point. (My actual use case has the progress controlled by load events from multiple tiles in OpenLayers).

Zeroing the percentage as the task completes just makes the bar slide backwards while it fades out at the end, which looks equally screwy.

If you are strictly talking about hitting the button again yeah.. its how the code manages any delta, forward or backward it does bounce back. Google drive spawns a new bar for each download instead of using the same one. I see your point, the code I believe works as intended. but yeah maybe there should be something like a hardReset feature to allow just completely restarting without the animations, a clean slate sort of thing.

So its always changing by a transform, with no way to not have the transform even if resetting.
a reset method would be nice
https://github.com/angular/material2/blob/master/src/lib/progress-bar/progress-bar.ts#L61

Does this currently have a workaround or something?

Closing this since I don't think realistically this would ever make it high enough on the priority queue to address.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vitaly-t picture vitaly-t  路  3Comments

Hiblton picture Hiblton  路  3Comments

kara picture kara  路  3Comments

LoganDupont picture LoganDupont  路  3Comments

Miiekeee picture Miiekeee  路  3Comments