From 1f703336cad0503aab4fb9ff97a00cbbb7f88bde Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Wed, 17 Nov 2021 22:07:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=AF=8C=E6=96=87=E6=9C=AC=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E7=BB=98=E5=88=B6=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/editor/core/draw/Draw.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/editor/core/draw/Draw.ts b/src/editor/core/draw/Draw.ts index d68c997..44cb227 100644 --- a/src/editor/core/draw/Draw.ts +++ b/src/editor/core/draw/Draw.ts @@ -207,12 +207,6 @@ export class Draw { } } positionList.push(positionItem) - this.ctx.fillText(element.value, x, y + curRow.ascent) - // 选区绘制 - const { startIndex, endIndex } = this.range.getRange() - if (startIndex < index && index <= endIndex) { - this.range.drawRange(x, y, metrics.width, curRow.height) - } // 下划线绘制 if (element.underline) { this.underline.render(x, y + curRow.height, metrics.width) @@ -225,6 +219,13 @@ export class Draw { if (element.highlight) { this.highlight.render(element.highlight, x, y, metrics.width, curRow.height) } + // 文本 + this.ctx.fillText(element.value, x, y + curRow.ascent) + // 选区绘制 + const { startIndex, endIndex } = this.range.getRange() + if (startIndex < index && index <= endIndex) { + this.range.drawRange(x, y, metrics.width, curRow.height) + } index++ x += metrics.width this.ctx.restore()