-
Notifications
You must be signed in to change notification settings - Fork 24
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
🐛[BUG]a标签在sketch插件中提供的web中调用getBoundingClientRect方法返回值问题 #47
Labels
help wanted
Extra attention is needed
Comments
我追了下代码,看起来原因是因为这个标签的文字换行了,导致获取rect的时候被撑开了,然后转换的layer的frame就变成了换行后整体的rect,不换行的话问题就不会出现,这个问题似乎不是很好解决 |
把你的 demo 拿过来了下:https://codesandbox.io/s/a-huanxingwenti-6mcbh |
这个问题目前来看有点难办,得对文本解析的方式重新做一次解析,我研究看看 |
辛苦 |
sketch 使用的模型和 浏览器的模型不太一致,解析难度很大。暂时不考虑支持了 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🐛 bug 描述
a标签在sketch插件中提供的web中执行
const bcr = node.getBoundingClientRect();
这段代码的时候,不能返回准确的自身rect值,返回的是父节点的值,有什么能替换的方法么
modify
上面描述的不准确,返回的还是自身的值 但是因为换行返回的rect被撑开了 在设置textLayer的x和y的时候就会出现不准确的情况
![test](https://user-images.githubusercontent.com/14813854/97654675-69f8cc80-1a9e-11eb-9a2b-5885b9ef6db6.png)
如图得到的rect就是红色的框
📷 复现步骤
在转换如下节点时复现的问题
The text was updated successfully, but these errors were encountered: