From c522c225b1c26d16abcccd74c0d2573fbeb88595 Mon Sep 17 00:00:00 2001 From: Hufe921 Date: Wed, 15 Feb 2023 20:58:55 +0800 Subject: [PATCH] fix:draw multi-segment richtext element in one row --- src/editor/core/draw/Draw.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/editor/core/draw/Draw.ts b/src/editor/core/draw/Draw.ts index 9653518..654e5ff 100644 --- a/src/editor/core/draw/Draw.ts +++ b/src/editor/core/draw/Draw.ts @@ -927,17 +927,24 @@ export class Draw { } else { this.textParticle.record(ctx, element, x, y + offsetY) } + const preElement = curRow.elementList[j - 1] // 下划线记录 if (element.underline) { this.underline.recordFillInfo(ctx, x, y + curRow.height, metrics.width, 0, element.color) + } else if (preElement && preElement.underline) { + this.underline.render(ctx) } // 删除线记录 if (element.strikeout) { this.strikeout.recordFillInfo(ctx, x, y + curRow.height / 2, metrics.width) + } else if (preElement && preElement.strikeout) { + this.strikeout.render(ctx) } // 元素高亮记录 if (element.highlight) { this.highlight.recordFillInfo(ctx, x, y, metrics.width, curRow.height, element.highlight) + } else if (preElement && preElement.highlight) { + this.highlight.render(ctx) } // 选区记录 const { startIndex, endIndex } = this.range.getRange()