Skip to content

Commit b10f55a

Browse files
committed
chore: refactor SVG text positioning
1 parent d1f8387 commit b10f55a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils/svg.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ export const editSvgText = function (mei: MindElixirInstance, textEl: SVGTextEle
6767
div.textContent = origin
6868
div.contentEditable = 'true'
6969
div.spellcheck = false
70-
const l = textEl.getAttribute('x') + 'px'
71-
const t = textEl.getAttribute('y') + 'px'
72-
div.style.cssText = `min-width:${100 - 8}px;position:absolute;left:${l};top:${t};`
70+
const l = textEl.getAttribute('x')
71+
const t = textEl.getAttribute('y')
72+
div.style.cssText = `min-width:${88}px;position:absolute;left:${l}px;top:${t}px;`
7373
const anchor = textEl.getAttribute('text-anchor')
7474
if (anchor === 'end') div.style.cssText += 'transform: translate(-100%, -100%);'
7575
else if (anchor === 'middle') div.style.cssText += 'transform: translate(-50%, -100%);'

0 commit comments

Comments
 (0)