Fix:修复safari浏览器节点存在图标时文字位置错位的问题

This commit is contained in:
wanglin2 2023-12-28 21:36:45 +08:00
parent f087b7102e
commit 794d3e9a53
2 changed files with 3 additions and 1 deletions

View File

@ -360,7 +360,8 @@ class Node {
// 文字 // 文字
if (this._textData) { if (this._textData) {
this._textData.node.attr('data-offsetx', textContentOffsetX) this._textData.node.attr('data-offsetx', textContentOffsetX)
this._textData.node.x(textContentOffsetX).y(0) // 修复safari浏览器节点存在图标时文字位置不正确的问题
;(this._textData.nodeContent || this._textData.node).x(textContentOffsetX).y(0)
textContentNested.add(this._textData.node) textContentNested.add(this._textData.node)
textContentOffsetX += this._textData.width + textContentItemMargin textContentOffsetX += this._textData.width + textContentItemMargin
} }

View File

@ -170,6 +170,7 @@ function createRichTextNode() {
g.add(foreignObject) g.add(foreignObject)
return { return {
node: g, node: g,
nodeContent: foreignObject,
width, width,
height height
} }