angular / angular/components

bug(mat-progress-spinner): stroke-width of svg circle not calculated properly for some diameter + strokeWidth values

オープン
#28,376 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: material/progress-spinner P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

The `circle` element of the `mat-progress-spinner`'s SVG does not fill up to the whole space of it's container. This only occurs for some combinations of `strokeWidth` and `diameter` inputs and only if the `stokeWidth` is smaller than 10.

E.g. for the values of `diameter=10` and `strokeWidth=5` the circle's `stroke-width` style is calculated to be `20.8333%` which is not filling up to the edge of the SVG container:
![image](https://github.com/angular/components/assets/25979251/3b88b29a-5d6e-4cea-965f-237c41f3b03c)

If the value of the circle's `stroke-width` is manually set to ~26%, it fits:
![image](https://github.com/angular/components/assets/25979251/19f5cd26-8cfe-4236-88c3-30003d960ea0)

### Reproduction

[StackBlitz link](https://stackblitz.com/edit/cxwm1t?file=src%2Fexample%2Fprogress-spinner-configurable-example.html,src%2Fexample%2Fprogress-spinner-configurable-example.html)

Steps to reproduce:
1. Use mat-progress-spinner
2. Set strokeWidth to value < 10
3. Set diameter to e.g. 24

### Expected Behavior

The SVG's `circle` element should fill up the whole space of its container element

### Actual Behavior

The SVG's `circle` element does not fill up the whole space of its container element and leaves some space in between

### Environment

- Angular: 17.0.7
- CDK/Material: 17.0.4
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

mat-progress-spinner の実装から始め、リンクされた StackBlitz を使って、diameter と strokeWidth を 10 未満で変化させながら問題を再現します。報告された値について、SVG 円の計算された stroke-width とコンテナの境界を比較し、その後、円が隙間を残さずコンテナを満たしていることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。