mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-30 12:28:33 +08:00
51b973d9d5
* feat: FloatButton support internal Badge * update docs * style * update docs * test: update snap * fix * update demo * test: update snap * update style * test: update snap * test: update snap * add docs * fix: update style * update * fix * fix * fix * update style * fix * update demo * add * add docs * snap * test: add test case * Update components/float-button/demo/badge.md Co-authored-by: MadCcc <1075746765@qq.com> * fix * docs: add debug demo * docs: add debug demo * test: update snap * fix border-radius * update snap * fix * fix * rename * style: use paddingXXS * fix * update demo * update snap * demo: add demo --------- Co-authored-by: MadCcc <1075746765@qq.com>
11 lines
349 B
TypeScript
11 lines
349 B
TypeScript
const getOffset = (radius: number): number => {
|
|
if (radius === 0) {
|
|
return 0;
|
|
}
|
|
// 如果要考虑通用性,这里应该用三角函数 Math.sin(45)
|
|
// 但是这个场景比较特殊,始终是等腰直角三角形,所以直接用 Math.sqrt() 开方即可
|
|
return radius - Math.sqrt(radius ** 2 / 2);
|
|
};
|
|
|
|
export default getOffset;
|