delowardev/vue3-circle-progress

Chart displays -1 when initialized with (and not changed) percentage of 0

Closed this issue · 4 comments

You may like to check if the step is !== 0 in your animateValue function

For example:

function animateValue(to) {
      const step = to - currentPercent.value;
      if (step) {
        const delay = props.transition / Math.abs(step);
        const counter = setInterval(() => {
          if (step > 0) {
            currentPercent.value += 1;
            if (currentPercent.value >= to) {
              clearInterval(counter);
            }
          } else {
            currentPercent.value -= 1;
            if (currentPercent.value <= to) {
              clearInterval(counter);
            }
          }
        }, delay);
      }
    }

@af-lsh thanks for bringing it up, I will update it soon. Also, you can make a pull request if you want to.

@delowardev Would you mind to create a new version of the module with this fix to publish it to the package managers?

@delowardev Would you mind to create a new version of the module with this fix to publish it to the package managers?

Hi @af-lsh,
I will push an update by tomorrow with the latest changes.
Thanks.

Thank you very much 👍