kirbydesign / designsystem

Kirby Design System
https://cookbook.kirby.design
MIT License
82 stars 22 forks source link

Progress circle: fix wrong animation direction #3442

Closed RasmusKjeldgaard closed 2 months ago

RasmusKjeldgaard commented 2 months ago

Which issue does this PR close?

This PR closes #3441

What is the new behavior?

The issue described here https://github.com/kirbydesign/designsystem/issues/3441#issuecomment-2056620529 happens because the colored part of the circle is rendered before the attribute bindings for stroke-dashoffset and stroke-dasharray have been evaluated, so the full circle is shown.

A view-initialized class is now added when the components view is rendered, and we then wait until this class is added before we apply the transition.

Additionally, instead of using stroke-dashoffset I have refactored the stroke to use only the dasharray attribute to set a stroke and gap length. One downside of this approach is that even with a stroke of length 0, we end up applying a stroke width, so we always draw a little dot when the value is 0.

image

To work around this I have added a conditional that sets the stroke width to 0, when value is 0.

Does this PR introduce a breaking change?

Are there any additional context?

Checklist:

The following tasks should be carried out in sequence in order to follow the process of contributing correctly.

Reminders

Review

When the pull request has been approved it will be merged to develop by Team Kirby.