Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(liquid): add liquid percent.toFixed #5648

Closed
wants to merge 4 commits into from
Closed

Conversation

ai-qing-hai
Copy link
Collaborator

@ai-qing-hai ai-qing-hai commented Oct 17, 2023

image

@@ -89,7 +89,7 @@ export const Liquid: CC<LiquidOptions> = (options) => {
}),
deepMix({}, DEFAULT_TEXT_OPTIONS, {
style: {
text: `${percent * 100} %`,
text: `${(percent * 100).toFixed(2)} %`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉不能简单的toFixed, 例如 0.55 这种会被转换为 55.00%

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

全局搜索 prettyNumber 这个函数,把它抽出来放在 src/utils/number.ts 里面,然后在这里使用:避免精度问题。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同时修改水波图的测试案例为这个特殊的文本,然后更新截图

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好了

@@ -89,7 +89,7 @@ export const Liquid: CC<LiquidOptions> = (options) => {
}),
deepMix({}, DEFAULT_TEXT_OPTIONS, {
style: {
text: `${percent * 100} %`,
text: `${(percent * 100).toFixed(2)} %`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

全局搜索 prettyNumber 这个函数,把它抽出来放在 src/utils/number.ts 里面,然后在这里使用:避免精度问题。

@@ -89,7 +89,7 @@ export const Liquid: CC<LiquidOptions> = (options) => {
}),
deepMix({}, DEFAULT_TEXT_OPTIONS, {
style: {
text: `${percent * 100} %`,
text: `${(percent * 100).toFixed(2)} %`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同时修改水波图的测试案例为这个特殊的文本,然后更新截图

@pearmini
Copy link
Member

这里 rebase 一下 v5,不要用 merge

@ai-qing-hai
Copy link
Collaborator Author

这里 rebase 一下 v5,不要用 merge

#5788 重新创建一个 pr

@hustcc hustcc deleted the fix-liquid-percent branch November 13, 2023 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants