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

feat(tinytag): replace svg to render #517

Merged
merged 6 commits into from
Nov 22, 2024
Merged

feat(tinytag): replace svg to render #517

merged 6 commits into from
Nov 22, 2024

Conversation

shiqiWang0
Copy link
Collaborator

@shiqiWang0 shiqiWang0 commented Nov 11, 2024

变更类型

请选择以下选项以描述 PR 的类型:

  • Bug 修复(修复现有问题)
  • 新功能(添加了一个功能)
  • 代码优化(性能改进、代码重构)
  • 文档更新
  • 单测新增或修改
  • 其他(请说明):

相关问题

关联 issue: #466

变更内容

通过 svg 进行处理, 替换原本通过 css 进行缩放实现 10px 的效果

详细描述

技术方案
https://dtstack.yuque.com/rd-center/tqk74v/bddbmase2lcqpszb

对应 Previewer

src/tinyTag/index.tsx Outdated Show resolved Hide resolved
src/tinyTag/index.tsx Outdated Show resolved Hide resolved
src/tinyTag/index.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@LuckyFBB LuckyFBB left a comment

Choose a reason for hiding this comment

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

+1

@jin-sir
Copy link
Collaborator

jin-sir commented Nov 13, 2024

上面的 paddingWidth 设置为 9,下面的 text 元素设置的 x 又是 4 ,是不是有问题?

@shiqiWang0
Copy link
Collaborator Author

上面的 paddingWidth 设置为 9,下面的 text 元素设置的 x 又是 4 ,是不是有问题?

text 在画布偏移 4的位置绘制, 那计算出来的 width 应该在该基础上 加 4 * 2

src/tinyTag/index.tsx Outdated Show resolved Hide resolved
<rect
x="0.5"
y="0.5"
width={width - 1}
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里加个判断吧?width初始值为0,在第一次渲染时,rect的width变成了 -1,会出现错误
Error: attribute width: A negative value is not valid. ("-1")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这个 会提取到 hook 里面, 处理掉

@jin-sir jin-sir self-requested a review November 22, 2024 02:59
@jin-sir jin-sir merged commit 09c4c77 into master Nov 22, 2024
1 check passed
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.

4 participants