angular / angular/components

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

未关闭
#28,376 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
area: material/progress-spinner P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
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 摘要。