| 178 | |
| 179 | // calculate the actual progress value |
| 180 | getProgress(){ |
| 181 | // calculate the normalized current progress |
| 182 | let progress = (this.value/this.total); |
| 183 | |
| 184 | // use relative progress calculation ? range between startValue and total is then used as 100% |
| 185 | // startValue (offset) is ignored for calculations |
| 186 | if (this.options.progressCalculationRelative){ |
| 187 | progress = (this.value-this.startValue)/(this.total-this.startValue); |
| 188 | } |
| 189 | |
| 190 | // handle NaN Errors caused by total=0. Set to complete in this case |
| 191 | if (isNaN(progress)){ |
| 192 | progress = (this.options && this.options.emptyOnZero) ? 0.0 : 1.0; |
| 193 | } |
| 194 | |
| 195 | // limiter |
| 196 | progress = Math.min(Math.max(progress, 0.0), 1.0); |
| 197 | |
| 198 | return progress; |
| 199 | } |
| 200 | |
| 201 | // update the bar value |
| 202 | // increment(delta, payload) |