ant-design / ant-design/html2sketch

🐛[BUG]a标签在sketch插件中提供的web中调用getBoundingClientRect方法返回值问题

Open
#47 6 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
TypeScript
Stars
179
Forks
27
PR merge metrics
No merged PRs in 30d

Description

### 🐛 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就是红色的框

### 📷 复现步骤

在转换如下节点时复现的问题

```html

阅读
xxxx协议

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the HTML-to-Sketch conversion for the provided span and a-node snippet, focusing on how getBoundingClientRect is used for textLayer positioning. Reproduce the wrapping case and verify that the resulting x and y coordinates match the visible link bounds rather than the red expanded rectangle.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.