fix:优化光标定位

This commit is contained in:
黄云飞
2021-11-19 16:35:24 +08:00
parent d848a23688
commit acd92aa5be
+4 -2
View File
@@ -50,8 +50,10 @@ export class Cursor {
const { metrics, coordinate: { leftTop, rightTop }, ascent } = cursorPosition
const height = metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent
const agentCursorDom = this.cursorAgent.getAgentCursorDom()
agentCursorDom.focus()
agentCursorDom.setSelectionRange(0, 0)
setTimeout(() => {
agentCursorDom.focus()
agentCursorDom.setSelectionRange(0, 0)
})
const curosrleft = `${rightTop[0]}px`
agentCursorDom.style.left = curosrleft
agentCursorDom.style.top = `${leftTop[1] + ascent - 12}px`