Closed parijatsahai closed 8 years ago
Hi, thanks for your input.
a) I like this. Can you send me a Pull request for this feature?
b) You can already customize the text with the formatValue
method. If you want to use more complex labels like icons etc. you may want to set showText
to false
and use your own label on top instead?
About (b), the formatValue
method is a bit restrictive because one cannot change text, for example, in the animation callback or elsewhere in the code based on certain other conditions. I didn't see any harm in exposing the label text with get/set functions.
In my pull request, I also have a showText()
function that allows setting showText
at any time, not just during creation.
Okay. I'm fine with that :) :+1:
Great work, guys! Have a few enhancement requests that should be relatively easy to incorporate: a) Add callback to the animate function: This is useful to perform certain task AFTER the animation completes, say, to hide the progress indicator, or to change the text on the indicator after the animation completes (which brings me to the next enhancement request). Here's my attempt to add the above enhancement:
function animate(_args,callback){ //Changes by Parijat Sahai - added callback
...
callback && animation.addEventListener("complete",callback); //Changes by Parijat Sahai - added callback
}
b) Add functions to get and set text of the label that shows in the middle of the circular progress bar. There are situations where the text has to be changed (from one icon to another for example) after the progress goes to 100, or if there is an error in the middle of the progress, or if the user aborts an operation. That said, the current code that sets the text on the label in the widget is too specific - it sets the text to the value of the progress, which isn't always desirable. Here's my attempt at the above enhancement:
function setText(_text){ $.label.text = _text; }
function getText(){ return $.label.text; }
exports.setText = setText;//Parijat Sahai edits
exports.getText = getText;//Parijat Sahai edits