fix: copy highlight element #193
This commit is contained in:
@@ -1178,6 +1178,17 @@ export class Draw {
|
||||
leftTop: [x, y]
|
||||
}
|
||||
} = positionList[curRow.startIndex + j]
|
||||
const preElement = curRow.elementList[j - 1]
|
||||
// 元素高亮记录
|
||||
if (element.highlight) {
|
||||
// 高亮元素相连需立即绘制,并记录下一元素坐标
|
||||
if (preElement && preElement.highlight && preElement.highlight !== element.highlight) {
|
||||
this.highlight.render(ctx)
|
||||
}
|
||||
this.highlight.recordFillInfo(ctx, x, y, metrics.width, curRow.height, element.highlight)
|
||||
} else if (preElement?.highlight) {
|
||||
this.highlight.render(ctx)
|
||||
}
|
||||
// 元素绘制
|
||||
if (element.type === ElementType.IMAGE) {
|
||||
this._drawRichText(ctx)
|
||||
@@ -1228,7 +1239,6 @@ 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)
|
||||
@@ -1241,16 +1251,6 @@ export class Draw {
|
||||
} else if (preElement?.strikeout) {
|
||||
this.strikeout.render(ctx)
|
||||
}
|
||||
// 元素高亮记录
|
||||
if (element.highlight) {
|
||||
// 高亮元素相连需立即绘制,并记录下一元素坐标
|
||||
if (preElement && preElement.highlight && preElement.highlight !== element.highlight) {
|
||||
this.highlight.render(ctx)
|
||||
}
|
||||
this.highlight.recordFillInfo(ctx, x, y, metrics.width, curRow.height, element.highlight)
|
||||
} else if (preElement?.highlight) {
|
||||
this.highlight.render(ctx)
|
||||
}
|
||||
// 选区记录
|
||||
const { zone: currentZone, startIndex, endIndex } = this.range.getRange()
|
||||
if (currentZone === zone && startIndex !== endIndex && startIndex <= index && index <= endIndex) {
|
||||
|
||||
Reference in New Issue
Block a user