bug(whiteboard): SVG 转 OpenAPI 时连线不绑定形状,独立三角箭头被转成单独节点(whiteboard-cli 0.2.13)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
Start with routes/svg.md and trace the SVG-to-OpenAPI conversion for line, path, and polygon elements; the payload does not name converter source files or tests. Reproduce with the supplied c.svg and CLI command, then compare the result with the DSL connector output. Done means endpoints on shapes are attached and small arrow triangles are represented by the connector’s arrow_style instead of separate nodes, or the SVG route documents the stated limitations.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
问题描述
按 lark-whiteboard skill 的 SVG 路线(routes/svg.md)绘图并用 whiteboard-cli -f svg --to openapi 转换后,连线有两个问题:
- 连线不绑定形状。 SVG 中的
<line>/<path>只转成带绝对坐标position的connector,即使端点正好落在<rect>边上,也不会生成attached_object/start_object/end_object。写入画板后,连线看起来连着方块,拖动方块时线不跟着动。 - 单独画的箭头变成独立对象。 用
<polygon>画的三角箭头被转成一个独立的svg节点,没有并入连线的arrow_style。一条带箭头的线因此变成“线 + 三角”两个对象,移动或修改时要分别处理。
飞书画板本身有原生的带箭头连线,并且支持连线吸附到形状。DSL 路线已经能输出绑定好的连线(见下方对照),所以这是 SVG 解析的输出方式问题。
环境
lark-cli version 1.0.97@larksuite/whiteboard-cli 0.2.13- macOS 27.0.1 arm64,飞书国内版
最小复现:无需飞书账号
c.svg:
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="200" viewBox="0 0 500 200">
<rect x="20" y="60" width="160" height="80" rx="8" fill="#EEF" stroke="#36C"/>
<rect x="320" y="60" width="160" height="80" rx="8" fill="#EEF" stroke="#36C"/>
<line x1="180" y1="100" x2="308" y2="100" stroke="#6D8EBE" stroke-width="2"/>
<polygon points="320,100 308,94 308,106" fill="#6D8EBE"/>
</svg>
npx -y @larksuite/[email protected] -i c.svg -f svg --to openapi --format json
得到(省略无关字段):
composite_shape (矩形 A)
composite_shape (矩形 B)
connector start.position={x:180,y:100} end.position={x:308,y:100} end.arrow_style=none (无 attached_object)
svg (三角箭头,独立节点)
用 marker-end 画箭头时箭头能变成 arrow_style: triangle_arrow,但连线同样只有绝对坐标,不绑定形状。
对照:同样的两个矩形和一条连线用 DSL("connector": {"from":"r1","to":"r2","fromAnchor":"right","toAnchor":"left","endArrow":"arrow"})转换,得到的 connector 带 start_object / end_object,拖动形状时线会跟着走。
期望行为
- 连线端点落在形状边缘(或在一定容差内)时,自动输出
attached_object/start_object/end_object,并换算出snap_to与相对position。 - 紧贴连线端点、作为箭头使用的小三角
<polygon>/<path>,识别后并入该连线的arrow_style,不再输出独立节点。 - 如果暂不支持,希望在
routes/svg.md中说明:需要可维护连线的图优先走 DSL 路线,SVG 中箭头只用marker-end。
影响
- 以 SVG 生成、后续需要人工维护的流程图和架构图,每条连线都要手动重新连接;带箭头的线对象数翻倍。
- 后续用户在画板上拖动方块调整布局时,连线和箭头会和方块脱离。
补充
- 与 #2855(带文字的形状被拆成“空形状 + 独立文字节点”)同属转换器输出问题,现象不同。
- 我们本地的临时绕过:转换后用后处理脚本,把端点落在形状边缘上的连线改成绑定形状,删掉紧贴端点的三角形节点,并把对应连线的
arrow_style设为原生箭头,再用lark-cli whiteboard +update --input_format raw写入。
- Lingua principale
- Go
- Stelle
- 18.2k
- Fork
- 1.4k
- Merge medio
- 1g 3h
- PR unite (30g)
- 18
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di larksuite/cli
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
domain/im
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
bug domain/doc
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
-
mail: all-ASCII draft bodies are hard-wrapped every 998 bytes, inserting newlines inside words and tagsForse già presa @linye157 l’ha presa 26 giorni fa. Apertadomain/mail
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
I maintainer di solito rispondono entro 1 giorno
-
auth: a 429 from the Token Endpoint during refresh deletes a still-valid loginForse già presa @linye157 l’ha presa 26 giorni fa. Apertabug domain/auth domain/im
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
larksuite/cli#2869 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di larksuite/cli
Issue simili
-
test_archive_is_downloaded_after_logout_login doesn't wait for the storage client after loginAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
list_issues and search_issues: inconsistent `fields` allow-lists (`html_url` rejected by list)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
github/github-mcp-server#3960 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
JuliusBrussee/caveman#1594 ·
I maintainer di solito rispondono entro 1 giorno
-
C-bug O-community X-blathers-triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
cockroachdb/cockroach#176264 · 1 commento ·
-
security trivy
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
kubefleet-dev/kubefleet#1068 ·
I maintainer di solito rispondono entro 3 giorni